home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1992-01-06 | 34.3 KB | [TEXT/MPS ] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, inited, Mon Jan 6 10:50:44 1992, modified Mon Jan 6 10:50:44 1992, creator 'MPS ', type ASCII, 34224 bytes "SampleTermWindow.c" , at 0x8630 638 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 12 53 61 6d 70 6c 65 | 54 65 72 6d 57 69 6e 64 |..Sample|TermWind|
|00000010| 6f 77 2e 63 00 00 00 00 | 00 00 00 00 00 00 00 00 |ow.c....|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 01 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 85 b0 00 | 00 02 7e a5 8e 2b 54 a5 |........|..~..+T.|
|00000060| 8e 2b 54 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.+T.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 e2 7a 00 00 |........|.....z..|
|00000080| 2f 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |/*******|********|
|00000090| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000000c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 0d |********|*******.|
|000000d0| 2a 2a 0d 2a 2a 20 20 50 | 72 6f 6a 65 63 74 20 4e |**.** P|roject N|
|000000e0| 61 6d 65 3a 09 53 61 6d | 70 6c 65 54 65 72 6d 57 |ame:.Sam|pleTermW|
|000000f0| 69 6e 64 6f 77 0d 2a 2a | 20 20 20 20 20 46 69 6c |indow.**| Fil|
|00000100| 65 20 4e 61 6d 65 3a 09 | 53 61 6d 70 6c 65 54 65 |e Name:.|SampleTe|
|00000110| 72 6d 57 69 6e 64 6f 77 | 2e 63 0d 2a 2a 0d 2a 2a |rmWindow|.c.**.**|
|00000120| 20 20 20 44 65 73 63 72 | 69 70 74 69 6f 6e 3a 09 | Descr|iption:.|
|00000130| 4f 75 72 20 6d 61 69 6e | 20 63 6f 64 65 20 66 6f |Our main| code fo|
|00000140| 72 20 74 68 69 73 20 61 | 70 70 6c 69 63 61 74 69 |r this a|pplicati|
|00000150| 6f 6e 73 2e 20 20 42 61 | 73 65 64 20 61 6c 6d 6f |ons. Ba|sed almo|
|00000160| 73 74 20 65 6e 74 69 72 | 65 6c 79 0d 2a 2a 09 09 |st entir|ely.**..|
|00000170| 09 09 09 6f 66 66 20 74 | 68 65 20 44 54 53 20 27 |...off t|he DTS '|
|00000180| 53 61 6d 70 6c 65 27 20 | 22 7b 63 65 78 61 6d 70 |Sample' |"{cexamp|
|00000190| 6c 65 73 7d 22 20 61 70 | 70 6c 69 63 61 74 69 6f |les}" ap|plicatio|
|000001a0| 6e 2e 0d 2a 2a 0d 2a 2a | 20 20 20 09 09 09 09 09 |n..**.**| .....|
|000001b0| 43 6f 70 79 72 69 67 68 | 74 20 a9 20 31 39 38 38 |Copyrigh|t . 1988|
|000001c0| 2d 31 39 39 31 20 41 70 | 70 6c 65 20 43 6f 6d 70 |-1991 Ap|ple Comp|
|000001d0| 75 74 65 72 2c 20 49 6e | 63 2e 0d 2a 2a 20 20 20 |uter, In|c..** |
|000001e0| 09 09 09 09 09 41 6c 6c | 20 72 69 67 68 74 73 20 |.....All| rights |
|000001f0| 72 65 73 65 72 76 65 64 | 2e 0d 2a 2a 0d 2a 2a 2a |reserved|..**.***|
|00000200| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000210| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000220| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000230| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000240| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 0d 2a 2a 20 |********|****.** |
|00000250| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000260| 20 20 20 20 20 20 41 20 | 55 20 54 20 48 20 4f 20 | A |U T H O |
|00000270| 52 20 20 20 49 20 44 20 | 45 20 4e 20 54 20 49 20 |R I D |E N T I |
|00000280| 54 20 59 0d 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |T Y.****|********|
|00000290| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000002a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000002b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000002c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000002d0| 2a 2a 2a 0d 2a 2a 0d 2a | 2a 09 49 6e 69 74 69 61 |***.**.*|*.Initia|
|000002e0| 6c 73 09 4e 61 6d 65 0d | 2a 2a 09 2d 2d 2d 2d 2d |ls.Name.|**.-----|
|000002f0| 2d 2d 2d 09 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |---.----|--------|
|00000300| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000310| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000320| 2d 2d 2d 0d 2a 2a 09 43 | 53 48 09 09 09 43 72 61 |---.**.C|SH...Cra|
|00000330| 69 67 20 48 6f 74 63 68 | 6b 69 73 73 0d 2a 2a 0d |ig Hotch|kiss.**.|
|00000340| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000350| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000360| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000370| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000380| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 0d |********|*******.|
|00000390| 2a 2a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |** | |
|000003a0| 20 20 20 20 20 20 20 20 | 52 20 45 20 56 20 49 20 | |R E V I |
|000003b0| 53 20 49 20 4f 20 4e 20 | 20 20 48 20 49 20 53 20 |S I O N | H I S |
|000003c0| 54 20 4f 20 52 20 59 0d | 2a 2a 2a 2a 2a 2a 2a 2a |T O R Y.|********|
|000003d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000003e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000003f0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000400| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000410| 2a 2a 2a 2a 2a 2a 2a 0d | 2a 2a 0d 09 43 68 61 6e |*******.|**..Chan|
|00000420| 67 65 20 48 69 73 74 6f | 72 79 20 28 6d 6f 73 74 |ge Histo|ry (most|
|00000430| 20 72 65 63 65 6e 74 20 | 66 69 72 73 74 29 3a 0d | recent |first):.|
|00000440| 2a 2a 0d 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |**.*****|********|
|00000450| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000460| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000470| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000480| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000490| 2a 2f 0d 0d 0d 23 69 66 | 64 65 66 20 44 55 4d 50 |*/...#if|def DUMP|
|000004a0| 46 49 4c 45 4e 41 4d 45 | 0d 09 23 70 72 61 67 6d |FILENAME|..#pragm|
|000004b0| 61 20 6c 6f 61 64 20 44 | 55 4d 50 46 49 4c 45 4e |a load D|UMPFILEN|
|000004c0| 41 4d 45 0d 23 65 6c 73 | 65 0d 09 23 69 6e 63 6c |AME.#els|e..#incl|
|000004d0| 75 64 65 20 3c 56 61 6c | 75 65 73 2e 68 3e 0d 09 |ude <Val|ues.h>..|
|000004e0| 23 69 6e 63 6c 75 64 65 | 20 3c 54 79 70 65 73 2e |#include| <Types.|
|000004f0| 68 3e 0d 09 23 69 6e 63 | 6c 75 64 65 20 3c 52 65 |h>..#inc|lude <Re|
|00000500| 73 6f 75 72 63 65 73 2e | 68 3e 0d 09 23 69 6e 63 |sources.|h>..#inc|
|00000510| 6c 75 64 65 20 3c 51 75 | 69 63 6b 44 72 61 77 2e |lude <Qu|ickDraw.|
|00000520| 68 3e 0d 09 23 69 6e 63 | 6c 75 64 65 20 3c 46 6f |h>..#inc|lude <Fo|
|00000530| 6e 74 73 2e 68 3e 0d 09 | 23 69 6e 63 6c 75 64 65 |nts.h>..|#include|
|00000540| 20 3c 45 76 65 6e 74 73 | 2e 68 3e 0d 09 23 69 6e | <Events|.h>..#in|
|00000550| 63 6c 75 64 65 20 3c 57 | 69 6e 64 6f 77 73 2e 68 |clude <W|indows.h|
|00000560| 3e 0d 09 23 69 6e 63 6c | 75 64 65 20 3c 4d 65 6e |>..#incl|ude <Men|
|00000570| 75 73 2e 68 3e 0d 09 23 | 69 6e 63 6c 75 64 65 20 |us.h>..#|include |
|00000580| 3c 54 65 78 74 45 64 69 | 74 2e 68 3e 0d 09 23 69 |<TextEdi|t.h>..#i|
|00000590| 6e 63 6c 75 64 65 20 3c | 44 69 61 6c 6f 67 73 2e |nclude <|Dialogs.|
|000005a0| 68 3e 0d 09 23 69 6e 63 | 6c 75 64 65 20 3c 44 65 |h>..#inc|lude <De|
|000005b0| 73 6b 2e 68 3e 0d 09 23 | 69 6e 63 6c 75 64 65 20 |sk.h>..#|include |
|000005c0| 3c 54 6f 6f 6c 55 74 69 | 6c 73 2e 68 3e 0d 09 23 |<ToolUti|ls.h>..#|
|000005d0| 69 6e 63 6c 75 64 65 20 | 3c 4d 65 6d 6f 72 79 2e |include |<Memory.|
|000005e0| 68 3e 0d 09 23 69 6e 63 | 6c 75 64 65 20 3c 53 65 |h>..#inc|lude <Se|
|000005f0| 67 4c 6f 61 64 2e 68 3e | 0d 09 23 69 6e 63 6c 75 |gLoad.h>|..#inclu|
|00000600| 64 65 20 3c 46 69 6c 65 | 73 2e 68 3e 0d 09 23 69 |de <File|s.h>..#i|
|00000610| 6e 63 6c 75 64 65 20 3c | 4f 53 55 74 69 6c 73 2e |nclude <|OSUtils.|
|00000620| 68 3e 0d 09 23 69 6e 63 | 6c 75 64 65 20 3c 4f 53 |h>..#inc|lude <OS|
|00000630| 45 76 65 6e 74 73 2e 68 | 3e 0d 09 23 69 6e 63 6c |Events.h|>..#incl|
|00000640| 75 64 65 20 3c 44 69 73 | 6b 49 6e 69 74 2e 68 3e |ude <Dis|kInit.h>|
|00000650| 0d 09 23 69 6e 63 6c 75 | 64 65 20 3c 50 61 63 6b |..#inclu|de <Pack|
|00000660| 61 67 65 73 2e 68 3e 0d | 09 23 69 6e 63 6c 75 64 |ages.h>.|.#includ|
|00000670| 65 20 3c 54 72 61 70 73 | 2e 68 3e 0d 0d 09 2f 2f |e <Traps|.h>...//|
|00000680| 74 68 65 73 65 20 61 72 | 65 20 73 70 65 63 69 66 |these ar|e specif|
|00000690| 69 63 20 74 6f 20 54 65 | 72 6d 57 69 6e 64 6f 77 |ic to Te|rmWindow|
|000006a0| 0d 09 23 69 6e 63 6c 75 | 64 65 20 09 3c 43 6f 6d |..#inclu|de .<Com|
|000006b0| 6d 52 65 73 6f 75 72 63 | 65 73 2e 68 3e 0d 09 23 |mResourc|es.h>..#|
|000006c0| 69 6e 63 6c 75 64 65 20 | 09 3c 43 54 42 55 74 69 |include |.<CTBUti|
|000006d0| 6c 69 74 69 65 73 2e 68 | 3e 0d 09 23 69 6e 63 6c |lities.h|>..#incl|
|000006e0| 75 64 65 20 09 3c 47 65 | 73 74 61 6c 74 45 71 75 |ude .<Ge|staltEqu|
|000006f0| 2e 68 3e 0d 09 23 69 6e | 63 6c 75 64 65 20 09 3c |.h>..#in|clude .<|
|00000700| 54 65 72 6d 69 6e 61 6c | 73 2e 68 3e 0d 23 65 6e |Terminal|s.h>.#en|
|00000710| 64 69 66 0d 0d 0d 0d 23 | 69 66 6e 64 65 66 20 5f |dif....#|ifndef _|
|00000720| 5f 53 41 4d 50 4c 45 54 | 45 52 4d 57 49 4e 44 4f |_SAMPLET|ERMWINDO|
|00000730| 57 5f 5f 0d 09 23 69 6e | 63 6c 75 64 65 20 22 53 |W__..#in|clude "S|
|00000740| 61 6d 70 6c 65 54 65 72 | 6d 57 69 6e 64 6f 77 2e |ampleTer|mWindow.|
|00000750| 68 22 0d 23 65 6e 64 69 | 66 0d 0d 23 69 66 6e 64 |h".#endi|f..#ifnd|
|00000760| 65 66 20 5f 5f 54 45 52 | 4d 57 49 4e 44 4f 57 5f |ef __TER|MWINDOW_|
|00000770| 5f 0d 09 23 69 6e 63 6c | 75 64 65 20 22 54 65 72 |_..#incl|ude "Ter|
|00000780| 6d 57 69 6e 64 6f 77 2e | 68 22 0d 23 65 6e 64 69 |mWindow.|h".#endi|
|00000790| 66 0d 0d 0d 0d 2f 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |f..../**|********|
|000007a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000007b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000007c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000007d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000007e0| 2a 2a 2a 2a 2a 2a 0d 2a | 09 09 09 09 09 09 09 09 |******.*|........|
|000007f0| 09 54 79 70 65 64 65 66 | 73 0d 2a 2a 2a 2a 2a 2a |.Typedef|s.******|
|00000800| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000810| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000820| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000830| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000840| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2f 0d 73 74 72 75 |********|**/.stru|
|00000850| 63 74 20 41 70 70 57 69 | 6e 64 6f 77 52 65 63 0d |ct AppWi|ndowRec.|
|00000860| 7b 0d 09 57 69 6e 64 6f | 77 52 65 63 6f 72 64 09 |{..Windo|wRecord.|
|00000870| 09 09 09 66 57 69 6e 64 | 6f 77 52 65 63 3b 09 09 |...fWind|owRec;..|
|00000880| 09 2f 2f 20 73 6f 20 69 | 74 20 63 61 6e 20 62 65 |.// so i|t can be|
|00000890| 20 61 20 57 69 6e 64 6f | 77 50 74 72 0d 09 73 68 | a Windo|wPtr..sh|
|000008a0| 6f 72 74 09 09 09 09 09 | 09 66 57 69 6e 64 6f 77 |ort.....|.fWindow|
|000008b0| 54 79 70 65 3b 09 09 2f | 2f 20 66 6f 72 20 61 70 |Type;../|/ for ap|
|000008c0| 70 6c 69 63 61 74 69 6f | 6e 20 75 73 61 67 65 0d |plicatio|n usage.|
|000008d0| 7d 3b 0d 74 79 70 65 64 | 65 66 09 73 74 72 75 63 |};.typed|ef.struc|
|000008e0| 74 20 41 70 70 57 69 6e | 64 6f 77 52 65 63 20 41 |t AppWin|dowRec A|
|000008f0| 70 70 57 69 6e 64 6f 77 | 52 65 63 3b 0d 74 79 70 |ppWindow|Rec;.typ|
|00000900| 65 64 65 66 09 41 70 70 | 57 69 6e 64 6f 77 52 65 |edef.App|WindowRe|
|00000910| 63 20 2a 41 70 70 57 69 | 6e 64 6f 77 50 74 72 3b |c *AppWi|ndowPtr;|
|00000920| 0d 0d 0d 0d 2f 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |..../***|********|
|00000930| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000940| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000950| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000960| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000970| 2a 2a 2a 2a 2a 0d 2a 09 | 09 09 09 09 09 09 09 4f |*****.*.|.......O|
|00000980| 74 68 65 72 20 63 6f 6e | 73 74 61 6e 74 73 0d 2a |ther con|stants.*|
|00000990| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000009a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000009b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000009c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000009d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2f |********|*******/|
|000009e0| 0d 09 2f 2f 20 74 79 70 | 65 73 20 6f 75 72 20 61 |..// typ|es our a|
|000009f0| 70 70 6c 69 63 61 74 69 | 6f 6e 20 75 6e 64 65 72 |pplicati|on under|
|00000a00| 73 74 61 6e 64 73 0d 23 | 64 65 66 69 6e 65 09 6b |stands.#|define.k|
|00000a10| 4e 49 4c 57 49 4e 44 4f | 57 09 09 09 09 09 30 0d |NILWINDO|W.....0.|
|00000a20| 23 64 65 66 69 6e 65 09 | 6b 55 4e 4b 4e 4f 57 4e |#define.|kUNKNOWN|
|00000a30| 57 49 4e 44 4f 57 09 09 | 09 09 31 0d 23 64 65 66 |WINDOW..|..1.#def|
|00000a40| 69 6e 65 09 6b 44 41 57 | 49 4e 44 4f 57 09 09 09 |ine.kDAW|INDOW...|
|00000a50| 09 09 32 0d 0d 23 64 65 | 66 69 6e 65 20 6b 41 50 |..2..#de|fine kAP|
|00000a60| 50 57 49 4e 44 4f 57 09 | 09 09 09 09 33 0d 23 64 |PWINDOW.|....3.#d|
|00000a70| 65 66 69 6e 65 20 6b 44 | 45 42 55 47 57 49 4e 44 |efine kD|EBUGWIND|
|00000a80| 4f 57 09 09 09 09 39 39 | 0d 0d 0d 0d 2f 2a 20 54 |OW....99|..../* T|
|00000a90| 68 65 20 22 67 22 20 70 | 72 65 66 69 78 20 69 73 |he "g" p|refix is|
|00000aa0| 20 75 73 65 64 20 74 6f | 20 65 6d 70 68 61 73 69 | used to| emphasi|
|00000ab0| 7a 65 20 74 68 61 74 20 | 61 20 76 61 72 69 61 62 |ze that |a variab|
|00000ac0| 6c 65 20 69 73 20 67 6c | 6f 62 61 6c 2e 20 2a 2f |le is gl|obal. */|
|00000ad0| 0d 0d 2f 2a 20 47 4d 61 | 63 20 69 73 20 75 73 65 |../* GMa|c is use|
|00000ae0| 64 20 74 6f 20 68 6f 6c | 64 20 74 68 65 20 72 65 |d to hol|d the re|
|00000af0| 73 75 6c 74 20 6f 66 20 | 61 20 53 79 73 45 6e 76 |sult of |a SysEnv|
|00000b00| 69 72 6f 6e 73 20 63 61 | 6c 6c 2e 20 54 68 69 73 |irons ca|ll. This|
|00000b10| 20 6d 61 6b 65 73 0d 20 | 20 20 69 74 20 63 6f 6e | makes. | it con|
|00000b20| 76 65 6e 69 65 6e 74 20 | 66 6f 72 20 61 6e 79 20 |venient |for any |
|00000b30| 72 6f 75 74 69 6e 65 20 | 74 6f 20 63 68 65 63 6b |routine |to check|
|00000b40| 20 74 68 65 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 | the env|ironment|
|00000b50| 2e 20 2a 2f 0d 53 79 73 | 45 6e 76 52 65 63 09 67 |. */.Sys|EnvRec.g|
|00000b60| 4d 61 63 3b 09 09 09 09 | 2f 2a 20 73 65 74 20 75 |Mac;....|/* set u|
|00000b70| 70 20 62 79 20 49 6e 69 | 74 69 61 6c 69 7a 65 20 |p by Ini|tialize |
|00000b80| 2a 2f 0d 0d 2f 2a 20 47 | 48 61 73 57 61 69 74 4e |*/../* G|HasWaitN|
|00000b90| 65 78 74 45 76 65 6e 74 | 20 69 73 20 73 65 74 20 |extEvent| is set |
|00000ba0| 61 74 20 73 74 61 72 74 | 75 70 2c 20 61 6e 64 20 |at start|up, and |
|00000bb0| 74 65 6c 6c 73 20 77 68 | 65 74 68 65 72 20 74 68 |tells wh|ether th|
|00000bc0| 65 20 57 61 69 74 4e 65 | 78 74 45 76 65 6e 74 0d |e WaitNe|xtEvent.|
|00000bd0| 20 20 20 74 72 61 70 20 | 69 73 20 61 76 61 69 6c | trap |is avail|
|00000be0| 61 62 6c 65 2e 20 49 66 | 20 69 74 20 69 73 20 66 |able. If| it is f|
|00000bf0| 61 6c 73 65 2c 20 77 65 | 20 6b 6e 6f 77 20 74 68 |alse, we| know th|
|00000c00| 61 74 20 77 65 20 6d 75 | 73 74 20 63 61 6c 6c 20 |at we mu|st call |
|00000c10| 47 65 74 4e 65 78 74 45 | 76 65 6e 74 2e 20 2a 2f |GetNextE|vent. */|
|00000c20| 0d 42 6f 6f 6c 65 61 6e | 09 09 67 48 61 73 57 61 |.Boolean|..gHasWa|
|00000c30| 69 74 4e 65 78 74 45 76 | 65 6e 74 3b 09 2f 2a 20 |itNextEv|ent;./* |
|00000c40| 73 65 74 20 75 70 20 62 | 79 20 49 6e 69 74 69 61 |set up b|y Initia|
|00000c50| 6c 69 7a 65 20 2a 2f 0d | 0d 2f 2a 20 47 49 6e 42 |lize */.|./* GInB|
|00000c60| 61 63 6b 67 72 6f 75 6e | 64 20 69 73 20 6d 61 69 |ackgroun|d is mai|
|00000c70| 6e 74 61 69 6e 65 64 20 | 62 79 20 6f 75 72 20 6f |ntained |by our o|
|00000c80| 73 45 76 65 6e 74 20 68 | 61 6e 64 6c 69 6e 67 20 |sEvent h|andling |
|00000c90| 72 6f 75 74 69 6e 65 73 | 2e 20 41 6e 79 20 70 61 |routines|. Any pa|
|00000ca0| 72 74 20 6f 66 0d 20 20 | 20 74 68 65 20 70 72 6f |rt of. | the pro|
|00000cb0| 67 72 61 6d 20 63 61 6e | 20 63 68 65 63 6b 20 69 |gram can| check i|
|00000cc0| 74 20 74 6f 20 66 69 6e | 64 20 6f 75 74 20 69 66 |t to fin|d out if|
|00000cd0| 20 69 74 20 69 73 20 63 | 75 72 72 65 6e 74 6c 79 | it is c|urrently|
|00000ce0| 20 69 6e 20 74 68 65 20 | 62 61 63 6b 67 72 6f 75 | in the |backgrou|
|00000cf0| 6e 64 2e 20 2a 2f 0d 42 | 6f 6f 6c 65 61 6e 09 09 |nd. */.B|oolean..|
|00000d00| 67 49 6e 42 61 63 6b 67 | 72 6f 75 6e 64 3b 09 09 |gInBackg|round;..|
|00000d10| 2f 2a 20 6d 61 69 6e 74 | 61 69 6e 65 64 20 62 79 |/* maint|ained by|
|00000d20| 20 49 6e 69 74 69 61 6c | 69 7a 65 20 61 6e 64 20 | Initial|ize and |
|00000d30| 44 6f 45 76 65 6e 74 20 | 2a 2f 0d 0d 0d 2f 2a 20 |DoEvent |*/.../* |
|00000d40| 54 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 20 67 6c |The foll|owing gl|
|00000d50| 6f 62 61 6c 73 20 61 72 | 65 20 74 68 65 20 73 74 |obals ar|e the st|
|00000d60| 61 74 65 20 6f 66 20 74 | 68 65 20 77 69 6e 64 6f |ate of t|he windo|
|00000d70| 77 2e 20 49 66 20 77 65 | 20 73 75 70 70 6f 72 74 |w. If we| support|
|00000d80| 65 64 20 6d 6f 72 65 20 | 74 68 61 6e 0d 20 20 20 |ed more |than. |
|00000d90| 6f 6e 65 20 77 69 6e 64 | 6f 77 2c 20 74 68 65 79 |one wind|ow, they|
|00000da0| 20 77 6f 75 6c 64 20 62 | 65 20 61 74 74 61 74 63 | would b|e attatc|
|00000db0| 68 65 64 20 74 6f 20 65 | 61 63 68 20 64 6f 63 75 |hed to e|ach docu|
|00000dc0| 6d 65 6e 74 2c 20 72 61 | 74 68 65 72 20 74 68 61 |ment, ra|ther tha|
|00000dd0| 6e 20 67 6c 6f 62 61 6c | 73 2e 20 2a 2f 0d 0d 2f |n global|s. */../|
|00000de0| 2a 20 47 53 74 6f 70 70 | 65 64 20 74 65 6c 6c 73 |* GStopp|ed tells|
|00000df0| 20 77 68 65 74 68 65 72 | 20 74 68 65 20 73 74 6f | whether| the sto|
|00000e00| 70 20 6c 69 67 68 74 20 | 69 73 20 63 75 72 72 65 |p light |is curre|
|00000e10| 6e 74 6c 79 20 6f 6e 20 | 73 74 6f 70 20 6f 72 20 |ntly on |stop or |
|00000e20| 67 6f 2e 20 2a 2f 0d 42 | 6f 6f 6c 65 61 6e 09 09 |go. */.B|oolean..|
|00000e30| 67 53 74 6f 70 70 65 64 | 3b 09 09 09 2f 2a 20 6d |gStopped|;.../* m|
|00000e40| 61 69 6e 74 61 69 6e 65 | 64 20 62 79 20 49 6e 69 |aintaine|d by Ini|
|00000e50| 74 69 61 6c 69 7a 65 20 | 61 6e 64 20 53 65 74 4c |tialize |and SetL|
|00000e60| 69 67 68 74 20 2a 2f 0d | 0d 2f 2a 20 47 53 74 6f |ight */.|./* GSto|
|00000e70| 70 52 65 63 74 20 61 6e | 64 20 67 47 6f 52 65 63 |pRect an|d gGoRec|
|00000e80| 74 20 61 72 65 20 74 68 | 65 20 72 65 63 74 61 6e |t are th|e rectan|
|00000e90| 67 6c 65 73 20 6f 66 20 | 74 68 65 20 74 77 6f 20 |gles of |the two |
|00000ea0| 73 74 6f 70 20 6c 69 67 | 68 74 73 20 69 6e 20 74 |stop lig|hts in t|
|00000eb0| 68 65 20 77 69 6e 64 6f | 77 2e 20 2a 2f 0d 52 65 |he windo|w. */.Re|
|00000ec0| 63 74 09 09 67 53 74 6f | 70 52 65 63 74 3b 09 09 |ct..gSto|pRect;..|
|00000ed0| 09 2f 2a 20 73 65 74 20 | 75 70 20 62 79 20 49 6e |./* set |up by In|
|00000ee0| 69 74 69 61 6c 69 7a 65 | 20 2a 2f 0d 52 65 63 74 |itialize| */.Rect|
|00000ef0| 09 09 67 47 6f 52 65 63 | 74 3b 09 09 09 2f 2a 20 |..gGoRec|t;.../* |
|00000f00| 73 65 74 20 75 70 20 62 | 79 20 49 6e 69 74 69 61 |set up b|y Initia|
|00000f10| 6c 69 7a 65 20 2a 2f 0d | 0d 2f 2f 0d 2f 2f 43 6f |lize */.|.//.//Co|
|00000f20| 6d 6d 6f 6e 20 54 65 72 | 6d 57 69 6e 64 6f 77 52 |mmon Ter|mWindowR|
|00000f30| 65 63 20 2d 2d 20 66 6f | 72 20 54 65 72 6d 57 69 |ec -- fo|r TermWi|
|00000f40| 6e 64 6f 77 0d 2f 2f 0d | 09 54 65 72 6d 57 69 6e |ndow.//.|.TermWin|
|00000f50| 64 6f 77 50 74 72 09 09 | 67 54 65 72 6d 57 69 6e |dowPtr..|gTermWin|
|00000f60| 64 6f 77 50 74 72 3b 0d | 0d 0d 2f 2a 20 48 65 72 |dowPtr;.|../* Her|
|00000f70| 65 20 61 72 65 20 64 65 | 63 6c 61 72 61 74 69 6f |e are de|claratio|
|00000f80| 6e 73 20 66 6f 72 20 61 | 6c 6c 20 6f 66 20 74 68 |ns for a|ll of th|
|00000f90| 65 20 43 20 72 6f 75 74 | 69 6e 65 73 2e 20 49 6e |e C rout|ines. In|
|00000fa0| 20 4d 50 57 20 33 2e 30 | 20 77 65 20 63 61 6e 20 | MPW 3.0| we can |
|00000fb0| 75 73 65 0d 20 20 20 61 | 63 74 75 61 6c 20 70 72 |use. a|ctual pr|
|00000fc0| 6f 74 6f 74 79 70 65 73 | 20 66 6f 72 20 70 61 72 |ototypes| for par|
|00000fd0| 61 6d 65 74 65 72 20 74 | 79 70 65 20 63 68 65 63 |ameter t|ype chec|
|00000fe0| 6b 69 6e 67 2e 20 2a 2f | 0d 76 6f 69 64 20 45 76 |king. */|.void Ev|
|00000ff0| 65 6e 74 4c 6f 6f 70 28 | 20 76 6f 69 64 20 29 3b |entLoop(| void );|
|00001000| 0d 76 6f 69 64 20 44 6f | 45 76 65 6e 74 28 20 45 |.void Do|Event( E|
|00001010| 76 65 6e 74 52 65 63 6f | 72 64 20 2a 65 76 65 6e |ventReco|rd *even|
|00001020| 74 20 29 3b 0d 70 61 73 | 63 61 6c 20 73 68 6f 72 |t );.pas|cal shor|
|00001030| 74 20 57 69 6e 64 6f 77 | 54 79 70 65 28 57 69 6e |t Window|Type(Win|
|00001040| 64 6f 77 50 74 72 20 74 | 68 65 57 69 6e 64 6f 77 |dowPtr t|heWindow|
|00001050| 50 74 72 29 3b 0d 76 6f | 69 64 20 41 64 6a 75 73 |Ptr);.vo|id Adjus|
|00001060| 74 43 75 72 73 6f 72 28 | 20 50 6f 69 6e 74 20 6d |tCursor(| Point m|
|00001070| 6f 75 73 65 2c 20 52 67 | 6e 48 61 6e 64 6c 65 20 |ouse, Rg|nHandle |
|00001080| 72 65 67 69 6f 6e 20 29 | 3b 0d 76 6f 69 64 20 47 |region )|;.void G|
|00001090| 65 74 47 6c 6f 62 61 6c | 4d 6f 75 73 65 28 20 50 |etGlobal|Mouse( P|
|000010a0| 6f 69 6e 74 20 2a 6d 6f | 75 73 65 20 29 3b 0d 76 |oint *mo|use );.v|
|000010b0| 6f 69 64 20 44 6f 55 70 | 64 61 74 65 28 20 57 69 |oid DoUp|date( Wi|
|000010c0| 6e 64 6f 77 50 74 72 20 | 77 69 6e 64 6f 77 20 29 |ndowPtr |window )|
|000010d0| 3b 0d 76 6f 69 64 20 44 | 6f 41 63 74 69 76 61 74 |;.void D|oActivat|
|000010e0| 65 28 20 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e |e( Windo|wPtr win|
|000010f0| 64 6f 77 2c 20 42 6f 6f | 6c 65 61 6e 20 62 65 63 |dow, Boo|lean bec|
|00001100| 6f 6d 69 6e 67 41 63 74 | 69 76 65 20 29 3b 0d 76 |omingAct|ive );.v|
|00001110| 6f 69 64 20 44 6f 43 6f | 6e 74 65 6e 74 43 6c 69 |oid DoCo|ntentCli|
|00001120| 63 6b 28 20 57 69 6e 64 | 6f 77 50 74 72 20 77 69 |ck( Wind|owPtr wi|
|00001130| 6e 64 6f 77 20 29 3b 0d | 76 6f 69 64 20 44 72 61 |ndow );.|void Dra|
|00001140| 77 57 69 6e 64 6f 77 28 | 20 57 69 6e 64 6f 77 50 |wWindow(| WindowP|
|00001150| 74 72 20 77 69 6e 64 6f | 77 20 29 3b 0d 76 6f 69 |tr windo|w );.voi|
|00001160| 64 20 41 64 6a 75 73 74 | 4d 65 6e 75 73 28 20 76 |d Adjust|Menus( v|
|00001170| 6f 69 64 20 29 3b 0d 76 | 6f 69 64 20 44 6f 4d 65 |oid );.v|oid DoMe|
|00001180| 6e 75 43 6f 6d 6d 61 6e | 64 28 20 6c 6f 6e 67 20 |nuComman|d( long |
|00001190| 6d 65 6e 75 52 65 73 75 | 6c 74 20 29 3b 0d 76 6f |menuResu|lt );.vo|
|000011a0| 69 64 20 53 65 74 4c 69 | 67 68 74 28 20 57 69 6e |id SetLi|ght( Win|
|000011b0| 64 6f 77 50 74 72 20 77 | 69 6e 64 6f 77 2c 20 42 |dowPtr w|indow, B|
|000011c0| 6f 6f 6c 65 61 6e 20 6e | 65 77 53 74 6f 70 70 65 |oolean n|ewStoppe|
|000011d0| 64 20 29 3b 0d 42 6f 6f | 6c 65 61 6e 20 44 6f 43 |d );.Boo|lean DoC|
|000011e0| 6c 6f 73 65 57 69 6e 64 | 6f 77 28 20 57 69 6e 64 |loseWind|ow( Wind|
|000011f0| 6f 77 50 74 72 20 77 69 | 6e 64 6f 77 20 29 3b 0d |owPtr wi|ndow );.|
|00001200| 76 6f 69 64 20 54 65 72 | 6d 69 6e 61 74 65 28 20 |void Ter|minate( |
|00001210| 76 6f 69 64 20 29 3b 0d | 76 6f 69 64 20 49 6e 69 |void );.|void Ini|
|00001220| 74 69 61 6c 69 7a 65 28 | 20 76 6f 69 64 20 29 3b |tialize(| void );|
|00001230| 0d 42 6f 6f 6c 65 61 6e | 20 47 6f 47 65 74 52 65 |.Boolean| GoGetRe|
|00001240| 63 74 28 20 73 68 6f 72 | 74 20 72 65 63 74 49 44 |ct( shor|t rectID|
|00001250| 2c 20 52 65 63 74 20 2a | 74 68 65 52 65 63 74 20 |, Rect *|theRect |
|00001260| 29 3b 0d 76 6f 69 64 20 | 46 6f 72 63 65 45 6e 76 |);.void |ForceEnv|
|00001270| 69 72 6f 6e 73 28 20 76 | 6f 69 64 20 29 3b 0d 42 |irons( v|oid );.B|
|00001280| 6f 6f 6c 65 61 6e 20 49 | 73 41 70 70 57 69 6e 64 |oolean I|sAppWind|
|00001290| 6f 77 28 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e |ow(Windo|wPtr win|
|000012a0| 64 6f 77 29 3b 0d 42 6f | 6f 6c 65 61 6e 20 49 73 |dow);.Bo|olean Is|
|000012b0| 44 41 57 69 6e 64 6f 77 | 28 20 57 69 6e 64 6f 77 |DAWindow|( Window|
|000012c0| 50 74 72 20 77 69 6e 64 | 6f 77 20 29 3b 0d 42 6f |Ptr wind|ow );.Bo|
|000012d0| 6f 6c 65 61 6e 20 54 72 | 61 70 41 76 61 69 6c 61 |olean Tr|apAvaila|
|000012e0| 62 6c 65 28 20 73 68 6f | 72 74 20 74 4e 75 6d 62 |ble( sho|rt tNumb|
|000012f0| 65 72 2c 20 54 72 61 70 | 54 79 70 65 20 74 54 79 |er, Trap|Type tTy|
|00001300| 70 65 20 29 3b 0d 76 6f | 69 64 20 41 6c 65 72 74 |pe );.vo|id Alert|
|00001310| 55 73 65 72 28 20 76 6f | 69 64 20 29 3b 0d 0d 0d |User( vo|id );...|
|00001320| 2f 2a 20 44 65 66 69 6e | 65 20 48 69 57 72 64 20 |/* Defin|e HiWrd |
|00001330| 61 6e 64 20 4c 6f 57 72 | 64 20 6d 61 63 72 6f 73 |and LoWr|d macros|
|00001340| 20 66 6f 72 20 65 66 66 | 69 63 69 65 6e 63 79 2e | for eff|iciency.|
|00001350| 20 2a 2f 0d 23 64 65 66 | 69 6e 65 20 48 69 57 72 | */.#def|ine HiWr|
|00001360| 64 28 61 4c 6f 6e 67 29 | 09 28 28 28 61 4c 6f 6e |d(aLong)|.(((aLon|
|00001370| 67 29 20 3e 3e 20 31 36 | 29 20 26 20 30 78 46 46 |g) >> 16|) & 0xFF|
|00001380| 46 46 29 0d 23 64 65 66 | 69 6e 65 20 4c 6f 57 72 |FF).#def|ine LoWr|
|00001390| 64 28 61 4c 6f 6e 67 29 | 09 28 28 61 4c 6f 6e 67 |d(aLong)|.((aLong|
|000013a0| 29 20 26 20 30 78 46 46 | 46 46 29 0d 0d 2f 2a 20 |) & 0xFF|FF)../* |
|000013b0| 44 65 66 69 6e 65 20 54 | 6f 70 4c 65 66 74 20 61 |Define T|opLeft a|
|000013c0| 6e 64 20 42 6f 74 52 69 | 67 68 74 20 6d 61 63 72 |nd BotRi|ght macr|
|000013d0| 6f 73 20 66 6f 72 20 63 | 6f 6e 76 65 6e 69 65 6e |os for c|onvenien|
|000013e0| 63 65 2e 20 4e 6f 74 69 | 63 65 20 74 68 65 20 69 |ce. Noti|ce the i|
|000013f0| 6d 70 6c 69 63 69 74 0d | 20 20 20 64 65 70 65 6e |mplicit.| depen|
|00001400| 64 65 6e 63 79 20 6f 6e | 20 74 68 65 20 6f 72 64 |dency on| the ord|
|00001410| 65 72 69 6e 67 20 6f 66 | 20 66 69 65 6c 64 73 20 |ering of| fields |
|00001420| 77 69 74 68 69 6e 20 61 | 20 52 65 63 74 20 2a 2f |within a| Rect */|
|00001430| 0d 23 64 65 66 69 6e 65 | 20 54 6f 70 4c 65 66 74 |.#define| TopLeft|
|00001440| 28 61 52 65 63 74 29 09 | 28 2a 20 28 50 6f 69 6e |(aRect).|(* (Poin|
|00001450| 74 20 2a 29 20 26 28 61 | 52 65 63 74 29 2e 74 6f |t *) &(a|Rect).to|
|00001460| 70 29 0d 23 64 65 66 69 | 6e 65 20 42 6f 74 52 69 |p).#defi|ne BotRi|
|00001470| 67 68 74 28 61 52 65 63 | 74 29 09 28 2a 20 28 50 |ght(aRec|t).(* (P|
|00001480| 6f 69 6e 74 20 2a 29 20 | 26 28 61 52 65 63 74 29 |oint *) |&(aRect)|
|00001490| 2e 62 6f 74 74 6f 6d 29 | 0d 0d 23 69 66 6e 64 65 |.bottom)|..#ifnde|
|000014a0| 66 20 54 48 49 4e 4b 5f | 43 0d 09 65 78 74 65 72 |f THINK_|C..exter|
|000014b0| 6e 20 76 6f 69 64 20 5f | 44 61 74 61 49 6e 69 74 |n void _|DataInit|
|000014c0| 28 29 3b 0d 23 65 6e 64 | 69 66 0d 0d 2f 2a 20 54 |();.#end|if../* T|
|000014d0| 68 69 73 20 72 6f 75 74 | 69 6e 65 20 69 73 20 70 |his rout|ine is p|
|000014e0| 61 72 74 20 6f 66 20 74 | 68 65 20 4d 50 57 20 72 |art of t|he MPW r|
|000014f0| 75 6e 74 69 6d 65 20 6c | 69 62 72 61 72 79 2e 20 |untime l|ibrary. |
|00001500| 54 68 69 73 20 65 78 74 | 65 72 6e 61 6c 0d 20 20 |This ext|ernal. |
|00001510| 20 72 65 66 65 72 65 6e | 63 65 20 74 6f 20 69 74 | referen|ce to it|
|00001520| 20 69 73 20 64 6f 6e 65 | 20 73 6f 20 74 68 61 74 | is done| so that|
|00001530| 20 77 65 20 63 61 6e 20 | 75 6e 6c 6f 61 64 20 69 | we can |unload i|
|00001540| 74 73 20 73 65 67 6d 65 | 6e 74 2c 20 25 41 35 49 |ts segme|nt, %A5I|
|00001550| 6e 69 74 2e 20 2a 2f 0d | 0d 0d 23 70 72 61 67 6d |nit. */.|..#pragm|
|00001560| 61 20 73 65 67 6d 65 6e | 74 20 4d 61 69 6e 0d 6d |a segmen|t Main.m|
|00001570| 61 69 6e 28 29 0d 7b 0d | 23 69 66 6e 64 65 66 20 |ain().{.|#ifndef |
|00001580| 54 48 49 4e 4b 5f 43 0d | 09 55 6e 6c 6f 61 64 53 |THINK_C.|.UnloadS|
|00001590| 65 67 28 28 50 74 72 29 | 20 5f 44 61 74 61 49 6e |eg((Ptr)| _DataIn|
|000015a0| 69 74 29 3b 09 09 2f 2a | 20 6e 6f 74 65 20 74 68 |it);../*| note th|
|000015b0| 61 74 20 5f 44 61 74 61 | 49 6e 69 74 20 6d 75 73 |at _Data|Init mus|
|000015c0| 74 20 6e 6f 74 20 62 65 | 20 69 6e 20 4d 61 69 6e |t not be| in Main|
|000015d0| 21 20 2a 2f 0d 23 65 6e | 64 69 66 0d 09 0d 09 2f |! */.#en|dif..../|
|000015e0| 2a 20 31 2e 30 31 20 2d | 20 63 61 6c 6c 20 74 6f |* 1.01 -| call to|
|000015f0| 20 46 6f 72 63 65 45 6e | 76 69 72 6f 6e 73 20 72 | ForceEn|virons r|
|00001600| 65 6d 6f 76 65 64 20 2a | 2f 0d 09 0d 09 2f 2a 09 |emoved *|/..../*.|
|00001610| 49 66 20 79 6f 75 20 68 | 61 76 65 20 73 74 61 63 |If you h|ave stac|
|00001620| 6b 20 72 65 71 75 69 72 | 65 6d 65 6e 74 73 20 74 |k requir|ements t|
|00001630| 68 61 74 20 64 69 66 66 | 65 72 20 66 72 6f 6d 20 |hat diff|er from |
|00001640| 74 68 65 20 64 65 66 61 | 75 6c 74 2c 0d 09 09 74 |the defa|ult,...t|
|00001650| 68 65 6e 20 79 6f 75 20 | 63 6f 75 6c 64 20 75 73 |hen you |could us|
|00001660| 65 20 53 65 74 41 70 70 | 6c 4c 69 6d 69 74 20 74 |e SetApp|lLimit t|
|00001670| 6f 20 69 6e 63 72 65 61 | 73 65 20 53 74 61 63 6b |o increa|se Stack|
|00001680| 53 70 61 63 65 20 61 74 | 20 0d 09 09 74 68 69 73 |Space at| ...this|
|00001690| 20 70 6f 69 6e 74 2c 20 | 62 65 66 6f 72 65 20 63 | point, |before c|
|000016a0| 61 6c 6c 69 6e 67 20 4d | 61 78 41 70 70 6c 5a 6f |alling M|axApplZo|
|000016b0| 6e 65 2e 20 2a 2f 0d 09 | 4d 61 78 41 70 70 6c 5a |ne. */..|MaxApplZ|
|000016c0| 6f 6e 65 28 29 3b 09 09 | 09 09 09 2f 2a 20 65 78 |one();..|.../* ex|
|000016d0| 70 61 6e 64 20 74 68 65 | 20 68 65 61 70 20 73 6f |pand the| heap so|
|000016e0| 20 63 6f 64 65 20 73 65 | 67 6d 65 6e 74 73 20 6c | code se|gments l|
|000016f0| 6f 61 64 20 61 74 20 74 | 68 65 20 74 6f 70 20 2a |oad at t|he top *|
|00001700| 2f 0d 0d 09 49 6e 69 74 | 69 61 6c 69 7a 65 28 29 |/...Init|ialize()|
|00001710| 3b 09 09 09 09 09 2f 2a | 20 69 6e 69 74 69 61 6c |;...../*| initial|
|00001720| 69 7a 65 20 74 68 65 20 | 70 72 6f 67 72 61 6d 20 |ize the |program |
|00001730| 2a 2f 0d 0d 23 69 66 6e | 64 65 66 20 54 48 49 4e |*/..#ifn|def THIN|
|00001740| 4b 5f 43 0d 09 55 6e 6c | 6f 61 64 53 65 67 28 28 |K_C..Unl|oadSeg((|
|00001750| 50 74 72 29 20 49 6e 69 | 74 69 61 6c 69 7a 65 29 |Ptr) Ini|tialize)|
|00001760| 3b 09 2f 2a 20 6e 6f 74 | 65 20 74 68 61 74 20 49 |;./* not|e that I|
|00001770| 6e 69 74 69 61 6c 69 7a | 65 20 6d 75 73 74 20 6e |nitializ|e must n|
|00001780| 6f 74 20 62 65 20 69 6e | 20 4d 61 69 6e 21 20 2a |ot be in| Main! *|
|00001790| 2f 0d 23 65 6e 64 69 66 | 0d 0d 09 45 76 65 6e 74 |/.#endif|...Event|
|000017a0| 4c 6f 6f 70 28 29 3b 09 | 09 09 09 09 2f 2a 20 63 |Loop();.|..../* c|
|000017b0| 61 6c 6c 20 74 68 65 20 | 6d 61 69 6e 20 65 76 65 |all the |main eve|
|000017c0| 6e 74 20 6c 6f 6f 70 20 | 2a 2f 0d 7d 0d 0d 0d 2f |nt loop |*/.}.../|
|000017d0| 2a 09 47 65 74 20 65 76 | 65 6e 74 73 20 66 6f 72 |*.Get ev|ents for|
|000017e0| 65 76 65 72 2c 20 61 6e | 64 20 68 61 6e 64 6c 65 |ever, an|d handle|
|000017f0| 20 74 68 65 6d 20 62 79 | 20 63 61 6c 6c 69 6e 67 | them by| calling|
|00001800| 20 44 6f 45 76 65 6e 74 | 2e 0d 09 47 65 74 20 74 | DoEvent|...Get t|
|00001810| 68 65 20 65 76 65 6e 74 | 73 20 62 79 20 63 61 6c |he event|s by cal|
|00001820| 6c 69 6e 67 20 57 61 69 | 74 4e 65 78 74 45 76 65 |ling Wai|tNextEve|
|00001830| 6e 74 2c 20 69 66 20 69 | 74 27 73 20 61 76 61 69 |nt, if i|t's avai|
|00001840| 6c 61 62 6c 65 2c 20 6f | 74 68 65 72 77 69 73 65 |lable, o|therwise|
|00001850| 0d 09 62 79 20 63 61 6c | 6c 69 6e 67 20 47 65 74 |..by cal|ling Get|
|00001860| 4e 65 78 74 45 76 65 6e | 74 2e 20 41 6c 73 6f 20 |NextEven|t. Also |
|00001870| 63 61 6c 6c 20 41 64 6a | 75 73 74 43 75 72 73 6f |call Adj|ustCurso|
|00001880| 72 20 65 61 63 68 20 74 | 69 6d 65 20 74 68 72 6f |r each t|ime thro|
|00001890| 75 67 68 20 74 68 65 20 | 6c 6f 6f 70 2e 20 2a 2f |ugh the |loop. */|
|000018a0| 0d 0d 23 70 72 61 67 6d | 61 20 73 65 67 6d 65 6e |..#pragm|a segmen|
|000018b0| 74 20 4d 61 69 6e 0d 76 | 6f 69 64 20 45 76 65 6e |t Main.v|oid Even|
|000018c0| 74 4c 6f 6f 70 28 29 0d | 7b 0d 09 52 67 6e 48 61 |tLoop().|{..RgnHa|
|000018d0| 6e 64 6c 65 09 63 75 72 | 73 6f 72 52 67 6e 3b 0d |ndle.cur|sorRgn;.|
|000018e0| 09 42 6f 6f 6c 65 61 6e | 09 09 67 6f 74 45 76 65 |.Boolean|..gotEve|
|000018f0| 6e 74 3b 0d 09 45 76 65 | 6e 74 52 65 63 6f 72 64 |nt;..Eve|ntRecord|
|00001900| 09 65 76 65 6e 74 3b 0d | 09 50 6f 69 6e 74 09 09 |.event;.|.Point..|
|00001910| 6d 6f 75 73 65 3b 0d 0d | 0d 09 63 75 72 73 6f 72 |mouse;..|..cursor|
|00001920| 52 67 6e 20 3d 20 4e 65 | 77 52 67 6e 28 29 3b 09 |Rgn = Ne|wRgn();.|
|00001930| 09 09 2f 2a 20 77 65 d5 | 6c 6c 20 70 61 73 73 20 |../* we.|ll pass |
|00001940| 57 4e 45 20 61 6e 20 65 | 6d 70 74 79 20 72 65 67 |WNE an e|mpty reg|
|00001950| 69 6f 6e 20 74 68 65 20 | 31 73 74 20 74 69 6d 65 |ion the |1st time|
|00001960| 20 74 68 72 75 20 2a 2f | 0d 09 64 6f 20 7b 0d 09 | thru */|..do {..|
|00001970| 09 2f 2a 20 75 73 65 20 | 57 4e 45 20 69 66 20 69 |./* use |WNE if i|
|00001980| 74 20 69 73 20 61 76 61 | 69 6c 61 62 6c 65 20 2a |t is ava|ilable *|
|00001990| 2f 0d 09 09 69 66 20 28 | 20 67 48 61 73 57 61 69 |/...if (| gHasWai|
|000019a0| 74 4e 65 78 74 45 76 65 | 6e 74 20 29 20 7b 0d 09 |tNextEve|nt ) {..|
|000019b0| 09 09 47 65 74 47 6c 6f | 62 61 6c 4d 6f 75 73 65 |..GetGlo|balMouse|
|000019c0| 28 26 6d 6f 75 73 65 29 | 3b 0d 09 09 09 41 64 6a |(&mouse)|;....Adj|
|000019d0| 75 73 74 43 75 72 73 6f | 72 28 6d 6f 75 73 65 2c |ustCurso|r(mouse,|
|000019e0| 20 63 75 72 73 6f 72 52 | 67 6e 29 3b 0d 09 09 09 | cursorR|gn);....|
|000019f0| 67 6f 74 45 76 65 6e 74 | 20 3d 20 57 61 69 74 4e |gotEvent| = WaitN|
|00001a00| 65 78 74 45 76 65 6e 74 | 28 65 76 65 72 79 45 76 |extEvent|(everyEv|
|00001a10| 65 6e 74 2c 20 26 65 76 | 65 6e 74 2c 20 4d 41 58 |ent, &ev|ent, MAX|
|00001a20| 4c 4f 4e 47 2c 20 63 75 | 72 73 6f 72 52 67 6e 29 |LONG, cu|rsorRgn)|
|00001a30| 3b 0d 09 09 7d 0d 09 09 | 65 6c 73 65 20 7b 0d 09 |;...}...|else {..|
|00001a40| 09 09 53 79 73 74 65 6d | 54 61 73 6b 28 29 3b 0d |..System|Task();.|
|00001a50| 09 09 09 67 6f 74 45 76 | 65 6e 74 20 3d 20 47 65 |...gotEv|ent = Ge|
|00001a60| 74 4e 65 78 74 45 76 65 | 6e 74 28 65 76 65 72 79 |tNextEve|nt(every|
|00001a70| 45 76 65 6e 74 2c 20 26 | 65 76 65 6e 74 29 3b 0d |Event, &|event);.|
|00001a80| 09 09 7d 0d 09 09 09 2f | 2f 0d 09 09 09 2f 2f 09 |..}..../|/....//.|
|00001a90| 54 68 65 73 65 20 61 72 | 65 20 74 68 65 20 64 69 |These ar|e the di|
|00001aa0| 73 70 61 74 63 68 65 72 | 73 20 66 6f 72 20 74 68 |spatcher|s for th|
|00001ab0| 65 20 54 65 72 6d 57 69 | 6e 64 6f 77 20 73 74 75 |e TermWi|ndow stu|
|00001ac0| 66 66 2e 0d 09 09 09 2f | 2f 0d 09 09 69 66 20 28 |ff...../|/...if (|
|00001ad0| 49 73 54 65 72 6d 57 69 | 6e 64 6f 77 45 76 65 6e |IsTermWi|ndowEven|
|00001ae0| 74 28 67 54 65 72 6d 57 | 69 6e 64 6f 77 50 74 72 |t(gTermW|indowPtr|
|00001af0| 2c 20 26 65 76 65 6e 74 | 29 29 20 7b 0d 09 09 09 |, &event|)) {....|
|00001b00| 48 61 6e 64 6c 65 54 65 | 72 6d 57 69 6e 64 6f 77 |HandleTe|rmWindow|
|00001b10| 45 76 65 6e 74 28 67 54 | 65 72 6d 57 69 6e 64 6f |Event(gT|ermWindo|
|00001b20| 77 50 74 72 2c 20 26 65 | 76 65 6e 74 29 3b 0d 09 |wPtr, &e|vent);..|
|00001b30| 09 09 67 6f 74 45 76 65 | 6e 74 20 3d 20 66 61 6c |..gotEve|nt = fal|
|00001b40| 73 65 3b 0d 09 09 7d 0d | 09 09 0d 09 09 69 66 20 |se;...}.|.....if |
|00001b50| 28 20 67 6f 74 45 76 65 | 6e 74 20 29 20 7b 0d 09 |( gotEve|nt ) {..|
|00001b60| 09 09 2f 2a 20 6d 61 6b | 65 20 73 75 72 65 20 77 |../* mak|e sure w|
|00001b70| 65 20 68 61 76 65 20 74 | 68 65 20 72 69 67 68 74 |e have t|he right|
|00001b80| 20 63 75 72 73 6f 72 20 | 62 65 66 6f 72 65 20 68 | cursor |before h|
|00001b90| 61 6e 64 6c 69 6e 67 20 | 74 68 65 20 65 76 65 6e |andling |the even|
|00001ba0| 74 20 2a 2f 0d 09 09 09 | 41 64 6a 75 73 74 43 75 |t */....|AdjustCu|
|00001bb0| 72 73 6f 72 28 65 76 65 | 6e 74 2e 77 68 65 72 65 |rsor(eve|nt.where|
|00001bc0| 2c 20 63 75 72 73 6f 72 | 52 67 6e 29 3b 0d 09 09 |, cursor|Rgn);...|
|00001bd0| 09 44 6f 45 76 65 6e 74 | 28 26 65 76 65 6e 74 29 |.DoEvent|(&event)|
|00001be0| 3b 0d 09 09 7d 0d 09 09 | 2f 2a 09 49 66 20 79 6f |;...}...|/*.If yo|
|00001bf0| 75 20 61 72 65 20 75 73 | 69 6e 67 20 6d 6f 64 65 |u are us|ing mode|
|00001c00| 6c 65 73 73 20 64 69 61 | 6c 6f 67 73 20 74 68 61 |less dia|logs tha|
|00001c10| 74 20 68 61 76 65 20 65 | 64 69 74 54 65 78 74 20 |t have e|ditText |
|00001c20| 69 74 65 6d 73 2c 0d 09 | 09 09 79 6f 75 20 77 69 |items,..|..you wi|
|00001c30| 6c 6c 20 77 61 6e 74 20 | 74 6f 20 63 61 6c 6c 20 |ll want |to call |
|00001c40| 49 73 44 69 61 6c 6f 67 | 45 76 65 6e 74 20 74 6f |IsDialog|Event to|
|00001c50| 20 67 69 76 65 20 74 68 | 65 20 63 61 72 65 74 20 | give th|e caret |
|00001c60| 61 20 63 68 61 6e 63 65 | 0d 09 09 09 74 6f 20 62 |a chance|....to b|
|00001c70| 6c 69 6e 6b 2c 20 65 76 | 65 6e 20 69 66 20 57 4e |link, ev|en if WN|
|00001c80| 45 2f 47 4e 45 20 72 65 | 74 75 72 6e 65 64 20 46 |E/GNE re|turned F|
|00001c90| 41 4c 53 45 2e 20 48 6f | 77 65 76 65 72 2c 20 63 |ALSE. Ho|wever, c|
|00001ca0| 68 65 63 6b 20 46 72 6f | 6e 74 57 69 6e 64 6f 77 |heck Fro|ntWindow|
|00001cb0| 0d 09 09 09 66 6f 72 20 | 61 20 6e 6f 6e 2d 4e 49 |....for |a non-NI|
|00001cc0| 4c 20 76 61 6c 75 65 20 | 62 65 66 6f 72 65 20 63 |L value |before c|
|00001cd0| 61 6c 6c 69 6e 67 20 49 | 73 44 69 61 6c 6f 67 45 |alling I|sDialogE|
|00001ce0| 76 65 6e 74 2e 20 2a 2f | 0d 09 7d 20 77 68 69 6c |vent. */|..} whil|
|00001cf0| 65 20 28 20 74 72 75 65 | 20 29 3b 09 2f 2a 20 6c |e ( true| );./* l|
|00001d00| 6f 6f 70 20 66 6f 72 65 | 76 65 72 3b 20 77 65 20 |oop fore|ver; we |
|00001d10| 71 75 69 74 20 76 69 61 | 20 45 78 69 74 54 6f 53 |quit via| ExitToS|
|00001d20| 68 65 6c 6c 20 2a 2f 0d | 7d 20 2f 2a 45 76 65 6e |hell */.|} /*Even|
|00001d30| 74 4c 6f 6f 70 2a 2f 0d | 0d 0d 2f 2a 20 44 6f 20 |tLoop*/.|../* Do |
|00001d40| 74 68 65 20 72 69 67 68 | 74 20 74 68 69 6e 67 20 |the righ|t thing |
|00001d50| 66 6f 72 20 61 6e 20 65 | 76 65 6e 74 2e 20 44 65 |for an e|vent. De|
|00001d60| 74 65 72 6d 69 6e 65 20 | 77 68 61 74 20 6b 69 6e |termine |what kin|
|00001d70| 64 20 6f 66 20 65 76 65 | 6e 74 20 69 74 20 69 73 |d of eve|nt it is|
|00001d80| 2c 20 61 6e 64 20 63 61 | 6c 6c 0d 20 74 68 65 20 |, and ca|ll. the |
|00001d90| 61 70 70 72 6f 70 72 69 | 61 74 65 20 72 6f 75 74 |appropri|ate rout|
|00001da0| 69 6e 65 73 2e 20 2a 2f | 0d 0d 23 70 72 61 67 6d |ines. */|..#pragm|
|00001db0| 61 20 73 65 67 6d 65 6e | 74 20 4d 61 69 6e 0d 76 |a segmen|t Main.v|
|00001dc0| 6f 69 64 20 44 6f 45 76 | 65 6e 74 28 65 76 65 6e |oid DoEv|ent(even|
|00001dd0| 74 29 0d 09 45 76 65 6e | 74 52 65 63 6f 72 64 09 |t)..Even|tRecord.|
|00001de0| 2a 65 76 65 6e 74 3b 0d | 7b 0d 09 73 68 6f 72 74 |*event;.|{..short|
|00001df0| 09 09 70 61 72 74 2c 20 | 65 72 72 3b 0d 09 57 69 |..part, |err;..Wi|
|00001e00| 6e 64 6f 77 50 74 72 09 | 77 69 6e 64 6f 77 3b 0d |ndowPtr.|window;.|
|00001e10| 09 42 6f 6f 6c 65 61 6e | 09 09 68 69 74 3b 0d 09 |.Boolean|..hit;..|
|00001e20| 63 68 61 72 09 09 6b 65 | 79 3b 0d 09 50 6f 69 6e |char..ke|y;..Poin|
|00001e30| 74 09 09 61 50 6f 69 6e | 74 3b 0d 0d 09 73 77 69 |t..aPoin|t;...swi|
|00001e40| 74 63 68 20 28 20 65 76 | 65 6e 74 2d 3e 77 68 61 |tch ( ev|ent->wha|
|00001e50| 74 20 29 20 7b 0d 09 09 | 63 61 73 65 20 6d 6f 75 |t ) {...|case mou|
|00001e60| 73 65 44 6f 77 6e 3a 0d | 09 09 09 70 61 72 74 20 |seDown:.|...part |
|00001e70| 3d 20 46 69 6e 64 57 69 | 6e 64 6f 77 28 65 76 65 |= FindWi|ndow(eve|
|00001e80| 6e 74 2d 3e 77 68 65 72 | 65 2c 20 26 77 69 6e 64 |nt->wher|e, &wind|
|00001e90| 6f 77 29 3b 0d 09 09 09 | 73 77 69 74 63 68 20 28 |ow);....|switch (|
|00001ea0| 20 70 61 72 74 20 29 20 | 7b 0d 09 09 09 09 63 61 | part ) |{.....ca|
|00001eb0| 73 65 20 69 6e 4d 65 6e | 75 42 61 72 3a 09 09 09 |se inMen|uBar:...|
|00001ec0| 09 2f 2a 20 70 72 6f 63 | 65 73 73 20 61 20 6d 6f |./* proc|ess a mo|
|00001ed0| 75 73 65 20 6d 65 6e 75 | 20 63 6f 6d 6d 61 6e 64 |use menu| command|
|00001ee0| 20 28 69 66 20 61 6e 79 | 29 20 2a 2f 0d 09 09 09 | (if any|) */....|
|00001ef0| 09 09 41 64 6a 75 73 74 | 4d 65 6e 75 73 28 29 3b |..Adjust|Menus();|
|00001f00| 0d 09 09 09 09 09 44 6f | 4d 65 6e 75 43 6f 6d 6d |......Do|MenuComm|
|00001f10| 61 6e 64 28 4d 65 6e 75 | 53 65 6c 65 63 74 28 65 |and(Menu|Select(e|
|00001f20| 76 65 6e 74 2d 3e 77 68 | 65 72 65 29 29 3b 0d 09 |vent->wh|ere));..|
|00001f30| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 09 63 |....brea|k;.....c|
|00001f40| 61 73 65 20 69 6e 53 79 | 73 57 69 6e 64 6f 77 3a |ase inSy|sWindow:|
|00001f50| 09 09 09 2f 2a 20 6c 65 | 74 20 74 68 65 20 73 79 |.../* le|t the sy|
|00001f60| 73 74 65 6d 20 68 61 6e | 64 6c 65 20 74 68 65 20 |stem han|dle the |
|00001f70| 6d 6f 75 73 65 44 6f 77 | 6e 20 2a 2f 0d 09 09 09 |mouseDow|n */....|
|00001f80| 09 09 53 79 73 74 65 6d | 43 6c 69 63 6b 28 65 76 |..System|Click(ev|
|00001f90| 65 6e 74 2c 20 77 69 6e | 64 6f 77 29 3b 0d 09 09 |ent, win|dow);...|
|00001fa0| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 09 63 61 |...break|;.....ca|
|00001fb0| 73 65 20 69 6e 43 6f 6e | 74 65 6e 74 3a 0d 09 09 |se inCon|tent:...|
|00001fc0| 09 09 09 69 66 20 28 20 | 77 69 6e 64 6f 77 20 21 |...if ( |window !|
|00001fd0| 3d 20 46 72 6f 6e 74 57 | 69 6e 64 6f 77 28 29 20 |= FrontW|indow() |
|00001fe0| 29 20 7b 0d 09 09 09 09 | 09 09 53 65 6c 65 63 74 |) {.....|..Select|
|00001ff0| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 3b 0d |Window(w|indow);.|
|00002000| 09 09 09 09 09 09 2f 2a | 44 6f 45 76 65 6e 74 28 |....../*|DoEvent(|
|00002010| 65 76 65 6e 74 29 3b 2a | 2f 09 2f 2a 20 75 73 65 |event);*|/./* use|
|00002020| 20 74 68 69 73 20 6c 69 | 6e 65 20 66 6f 72 20 22 | this li|ne for "|
|00002030| 64 6f 20 66 69 72 73 74 | 20 63 6c 69 63 6b 22 20 |do first| click" |
|00002040| 2a 2f 0d 09 09 09 09 09 | 7d 20 65 6c 73 65 0d 09 |*/......|} else..|
|00002050| 09 09 09 09 09 44 6f 43 | 6f 6e 74 65 6e 74 43 6c |.....DoC|ontentCl|
|00002060| 69 63 6b 28 77 69 6e 64 | 6f 77 29 3b 0d 09 09 09 |ick(wind|ow);....|
|00002070| 09 09 62 72 65 61 6b 3b | 0d 09 09 09 09 63 61 73 |..break;|.....cas|
|00002080| 65 20 69 6e 44 72 61 67 | 3a 09 09 09 09 2f 2a 20 |e inDrag|:..../* |
|00002090| 70 61 73 73 20 73 63 72 | 65 65 6e 42 69 74 73 2e |pass scr|eenBits.|
|000020a0| 62 6f 75 6e 64 73 20 74 | 6f 20 67 65 74 20 61 6c |bounds t|o get al|
|000020b0| 6c 20 67 44 65 76 69 63 | 65 73 20 2a 2f 0d 09 09 |l gDevic|es */...|
|000020c0| 09 09 09 44 72 61 67 57 | 69 6e 64 6f 77 28 77 69 |...DragW|indow(wi|
|000020d0| 6e 64 6f 77 2c 20 65 76 | 65 6e 74 2d 3e 77 68 65 |ndow, ev|ent->whe|
|000020e0| 72 65 2c 20 26 71 64 2e | 73 63 72 65 65 6e 42 69 |re, &qd.|screenBi|
|000020f0| 74 73 2e 62 6f 75 6e 64 | 73 29 3b 0d 09 09 09 09 |ts.bound|s);.....|
|00002100| 09 62 72 65 61 6b 3b 0d | 09 09 09 09 63 61 73 65 |.break;.|....case|
|00002110| 20 69 6e 47 72 6f 77 3a | 0d 09 09 09 09 09 62 72 | inGrow:|......br|
|00002120| 65 61 6b 3b 0d 09 09 09 | 09 63 61 73 65 20 69 6e |eak;....|.case in|
|00002130| 5a 6f 6f 6d 49 6e 3a 0d | 09 09 09 09 63 61 73 65 |ZoomIn:.|....case|
|00002140| 20 69 6e 5a 6f 6f 6d 4f | 75 74 3a 0d 09 09 09 09 | inZoomO|ut:.....|
|00002150| 09 68 69 74 20 3d 20 54 | 72 61 63 6b 42 6f 78 28 |.hit = T|rackBox(|
|00002160| 77 69 6e 64 6f 77 2c 20 | 65 76 65 6e 74 2d 3e 77 |window, |event->w|
|00002170| 68 65 72 65 2c 20 70 61 | 72 74 29 3b 0d 09 09 09 |here, pa|rt);....|
|00002180| 09 09 69 66 20 28 20 68 | 69 74 20 29 20 7b 0d 09 |..if ( h|it ) {..|
|00002190| 09 09 09 09 09 53 65 74 | 50 6f 72 74 28 77 69 6e |.....Set|Port(win|
|000021a0| 64 6f 77 29 3b 09 09 09 | 09 2f 2a 20 74 68 65 20 |dow);...|./* the |
|000021b0| 77 69 6e 64 6f 77 20 6d | 75 73 74 20 62 65 20 74 |window m|ust be t|
|000021c0| 68 65 20 63 75 72 72 65 | 6e 74 20 70 6f 72 74 2e |he curre|nt port.|
|000021d0| 2e 2e 20 2a 2f 0d 09 09 | 09 09 09 09 45 72 61 73 |.. */...|....Eras|
|000021e0| 65 52 65 63 74 28 26 77 | 69 6e 64 6f 77 2d 3e 70 |eRect(&w|indow->p|
|000021f0| 6f 72 74 52 65 63 74 29 | 3b 09 2f 2a 20 62 65 63 |ortRect)|;./* bec|
|00002200| 61 75 73 65 20 6f 66 20 | 61 20 62 75 67 20 69 6e |ause of |a bug in|
|00002210| 20 5a 6f 6f 6d 57 69 6e | 64 6f 77 20 2a 2f 0d 09 | ZoomWin|dow */..|
|00002220| 09 09 09 09 09 5a 6f 6f | 6d 57 69 6e 64 6f 77 28 |.....Zoo|mWindow(|
|00002230| 77 69 6e 64 6f 77 2c 20 | 70 61 72 74 2c 20 74 72 |window, |part, tr|
|00002240| 75 65 29 3b 09 2f 2a 20 | 6e 6f 74 65 20 74 68 61 |ue);./* |note tha|
|00002250| 74 20 77 65 20 69 6e 76 | 61 6c 69 64 61 74 65 20 |t we inv|alidate |
|00002260| 61 6e 64 20 65 72 61 73 | 65 2e 2e 2e 20 2a 2f 0d |and eras|e... */.|
|00002270| 09 09 09 09 09 09 49 6e | 76 61 6c 52 65 63 74 28 |......In|valRect(|
|00002280| 26 77 69 6e 64 6f 77 2d | 3e 70 6f 72 74 52 65 63 |&window-|>portRec|
|00002290| 74 29 3b 09 2f 2a 20 74 | 6f 20 6d 61 6b 65 20 74 |t);./* t|o make t|
|000022a0| 68 69 6e 67 73 20 6c 6f | 6f 6b 20 62 65 74 74 65 |hings lo|ok bette|
|000022b0| 72 20 6f 6e 2d 73 63 72 | 65 65 6e 20 2a 2f 0d 09 |r on-scr|een */..|
|000022c0| 09 09 09 09 7d 0d 09 09 | 09 09 09 62 72 65 61 6b |....}...|...break|
|000022d0| 3b 0d 09 09 09 7d 0d 09 | 09 09 62 72 65 61 6b 3b |;....}..|..break;|
|000022e0| 0d 09 09 63 61 73 65 20 | 6b 65 79 44 6f 77 6e 3a |...case |keyDown:|
|000022f0| 0d 09 09 63 61 73 65 20 | 61 75 74 6f 4b 65 79 3a |...case |autoKey:|
|00002300| 09 09 09 09 09 09 2f 2a | 20 63 68 65 63 6b 20 66 |....../*| check f|
|00002310| 6f 72 20 6d 65 6e 75 6b | 65 79 20 65 71 75 69 76 |or menuk|ey equiv|
|00002320| 61 6c 65 6e 74 73 20 2a | 2f 0d 09 09 09 6b 65 79 |alents *|/....key|
|00002330| 20 3d 20 65 76 65 6e 74 | 2d 3e 6d 65 73 73 61 67 | = event|->messag|
|00002340| 65 20 26 20 63 68 61 72 | 43 6f 64 65 4d 61 73 6b |e & char|CodeMask|
|00002350| 3b 0d 09 09 09 69 66 20 | 28 20 65 76 65 6e 74 2d |;....if |( event-|
|00002360| 3e 6d 6f 64 69 66 69 65 | 72 73 20 26 20 63 6d 64 |>modifie|rs & cmd|
|00002370| 4b 65 79 20 29 09 09 09 | 2f 2a 20 43 6f 6d 6d 61 |Key )...|/* Comma|
|00002380| 6e 64 20 6b 65 79 20 64 | 6f 77 6e 20 2a 2f 0d 09 |nd key d|own */..|
|00002390| 09 09 09 69 66 20 28 20 | 65 76 65 6e 74 2d 3e 77 |...if ( |event->w|
|000023a0| 68 61 74 20 3d 3d 20 6b | 65 79 44 6f 77 6e 20 29 |hat == k|eyDown )|
|000023b0| 20 7b 0d 09 09 09 09 09 | 41 64 6a 75 73 74 4d 65 | {......|AdjustMe|
|000023c0| 6e 75 73 28 29 3b 09 09 | 09 09 09 09 2f 2a 20 65 |nus();..|..../* e|
|000023d0| 6e 61 62 6c 65 2f 64 69 | 73 61 62 6c 65 2f 63 68 |nable/di|sable/ch|
|000023e0| 65 63 6b 20 6d 65 6e 75 | 20 69 74 65 6d 73 20 70 |eck menu| items p|
|000023f0| 72 6f 70 65 72 6c 79 20 | 2a 2f 0d 09 09 09 09 09 |roperly |*/......|
|00002400| 44 6f 4d 65 6e 75 43 6f | 6d 6d 61 6e 64 28 4d 65 |DoMenuCo|mmand(Me|
|00002410| 6e 75 4b 65 79 28 6b 65 | 79 29 29 3b 0d 09 09 09 |nuKey(ke|y));....|
|00002420| 09 7d 0d 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 63 |.}....br|eak;...c|
|00002430| 61 73 65 20 61 63 74 69 | 76 61 74 65 45 76 74 3a |ase acti|vateEvt:|
|00002440| 0d 09 09 09 44 6f 41 63 | 74 69 76 61 74 65 28 28 |....DoAc|tivate((|
|00002450| 57 69 6e 64 6f 77 50 74 | 72 29 20 65 76 65 6e 74 |WindowPt|r) event|
|00002460| 2d 3e 6d 65 73 73 61 67 | 65 2c 20 28 65 76 65 6e |->messag|e, (even|
|00002470| 74 2d 3e 6d 6f 64 69 66 | 69 65 72 73 20 26 20 61 |t->modif|iers & a|
|00002480| 63 74 69 76 65 46 6c 61 | 67 29 20 21 3d 20 30 29 |ctiveFla|g) != 0)|
|00002490| 3b 0d 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 63 61 |;....bre|ak;...ca|
|000024a0| 73 65 20 75 70 64 61 74 | 65 45 76 74 3a 0d 09 09 |se updat|eEvt:...|
|000024b0| 09 44 6f 55 70 64 61 74 | 65 28 28 57 69 6e 64 6f |.DoUpdat|e((Windo|
|000024c0| 77 50 74 72 29 20 65 76 | 65 6e 74 2d 3e 6d 65 73 |wPtr) ev|ent->mes|
|000024d0| 73 61 67 65 29 3b 0d 09 | 09 09 62 72 65 61 6b 3b |sage);..|..break;|
|000024e0| 0d 09 09 2f 2a 09 31 2e | 30 31 20 2d 20 49 74 20 |.../*.1.|01 - It |
|000024f0| 69 73 20 6e 6f 74 20 61 | 20 62 61 64 20 69 64 65 |is not a| bad ide|
|00002500| 61 20 74 6f 20 61 74 20 | 6c 65 61 73 74 20 63 61 |a to at |least ca|
|00002510| 6c 6c 20 44 49 42 61 64 | 4d 6f 75 6e 74 20 69 6e |ll DIBad|Mount in|
|00002520| 20 72 65 73 70 6f 6e 73 | 65 0d 09 09 09 74 6f 20 | respons|e....to |
|00002530| 61 20 64 69 73 6b 45 76 | 74 2c 20 73 6f 20 74 68 |a diskEv|t, so th|
|00002540| 61 74 20 74 68 65 20 75 | 73 65 72 20 63 61 6e 20 |at the u|ser can |
|00002550| 66 6f 72 6d 61 74 20 61 | 20 66 6c 6f 70 70 79 2e |format a| floppy.|
|00002560| 20 2a 2f 0d 09 09 63 61 | 73 65 20 64 69 73 6b 45 | */...ca|se diskE|
|00002570| 76 74 3a 0d 09 09 09 69 | 66 20 28 20 48 69 57 6f |vt:....i|f ( HiWo|
|00002580| 72 64 28 65 76 65 6e 74 | 2d 3e 6d 65 73 73 61 67 |rd(event|->messag|
|00002590| 65 29 20 21 3d 20 6e 6f | 45 72 72 20 29 20 7b 0d |e) != no|Err ) {.|
|000025a0| 09 09 09 09 53 65 74 50 | 74 28 26 61 50 6f 69 6e |....SetP|t(&aPoin|
|000025b0| 74 2c 20 6b 44 49 4c 65 | 66 74 2c 20 6b 44 49 54 |t, kDILe|ft, kDIT|
|000025c0| 6f 70 29 3b 0d 09 09 09 | 09 65 72 72 20 3d 20 44 |op);....|.err = D|
|000025d0| 49 42 61 64 4d 6f 75 6e | 74 28 61 50 6f 69 6e 74 |IBadMoun|t(aPoint|
|000025e0| 2c 20 65 76 65 6e 74 2d | 3e 6d 65 73 73 61 67 65 |, event-|>message|
|000025f0| 29 3b 0d 09 09 09 7d 0d | 09 09 09 62 72 65 61 6b |);....}.|...break|
|00002600| 3b 0d 09 09 63 61 73 65 | 20 6b 4f 53 45 76 65 6e |;...case| kOSEven|
|00002610| 74 3a 0d 09 09 2f 2a 09 | 31 2e 30 32 20 2d 20 6d |t:.../*.|1.02 - m|
|00002620| 75 73 74 20 42 69 74 41 | 4e 44 20 77 69 74 68 20 |ust BitA|ND with |
|00002630| 30 78 30 46 46 20 74 6f | 20 67 65 74 20 6f 6e 6c |0x0FF to| get onl|
|00002640| 79 20 6c 6f 77 20 62 79 | 74 65 20 2a 2f 0d 09 09 |y low by|te */...|
|00002650| 09 73 77 69 74 63 68 20 | 28 28 65 76 65 6e 74 2d |.switch |((event-|
|00002660| 3e 6d 65 73 73 61 67 65 | 20 3e 3e 20 32 34 29 20 |>message| >> 24) |
|00002670| 26 20 30 78 30 46 46 29 | 20 7b 09 09 2f 2a 20 68 |& 0x0FF)| {../* h|
|00002680| 69 67 68 20 62 79 74 65 | 20 6f 66 20 6d 65 73 73 |igh byte| of mess|
|00002690| 61 67 65 20 2a 2f 0d 09 | 09 09 09 63 61 73 65 20 |age */..|...case |
|000026a0| 6b 53 75 73 70 65 6e 64 | 52 65 73 75 6d 65 4d 65 |kSuspend|ResumeMe|
|000026b0| 73 73 61 67 65 3a 09 09 | 2f 2a 20 73 75 73 70 65 |ssage:..|/* suspe|
|000026c0| 6e 64 2f 72 65 73 75 6d | 65 20 69 73 20 61 6c 73 |nd/resum|e is als|
|000026d0| 6f 20 61 6e 20 61 63 74 | 69 76 61 74 65 2f 64 65 |o an act|ivate/de|
|000026e0| 61 63 74 69 76 61 74 65 | 20 2a 2f 0d 09 09 09 09 |activate| */.....|
|000026f0| 09 67 49 6e 42 61 63 6b | 67 72 6f 75 6e 64 20 3d |.gInBack|ground =|
|00002700| 20 28 65 76 65 6e 74 2d | 3e 6d 65 73 73 61 67 65 | (event-|>message|
|00002710| 20 26 20 6b 52 65 73 75 | 6d 65 4d 61 73 6b 29 20 | & kResu|meMask) |
|00002720| 3d 3d 20 30 3b 0d 09 09 | 09 09 09 44 6f 41 63 74 |== 0;...|...DoAct|
|00002730| 69 76 61 74 65 28 46 72 | 6f 6e 74 57 69 6e 64 6f |ivate(Fr|ontWindo|
|00002740| 77 28 29 2c 20 21 67 49 | 6e 42 61 63 6b 67 72 6f |w(), !gI|nBackgro|
|00002750| 75 6e 64 29 3b 0d 09 09 | 09 09 09 62 72 65 61 6b |und);...|...break|
|00002760| 3b 0d 09 09 09 7d 0d 09 | 09 09 62 72 65 61 6b 3b |;....}..|..break;|
|00002770| 0d 09 7d 0d 7d 20 2f 2a | 44 6f 45 76 65 6e 74 2a |..}.} /*|DoEvent*|
|00002780| 2f 0d 0d 0d 0d 2f 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |/..../**|********|
|00002790| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000027a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000027b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000027c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000027d0| 2a 2a 2a 2a 2a 2a 0d 2a | 09 50 72 6f 63 65 64 75 |******.*|.Procedu|
|000027e0| 72 65 3a 09 57 69 6e 64 | 6f 77 54 79 70 65 28 57 |re:.Wind|owType(W|
|000027f0| 69 6e 64 6f 77 50 74 72 | 20 74 68 65 57 69 6e 64 |indowPtr| theWind|
|00002800| 6f 77 50 74 72 29 0d 2a | 09 50 75 72 70 6f 73 65 |owPtr).*|.Purpose|
|00002810| 3a 09 52 65 74 75 72 6e | 73 20 6f 75 72 20 77 69 |:.Return|s our wi|
|00002820| 6e 64 6f 77 20 74 79 70 | 65 0d 2a 09 50 61 73 73 |ndow typ|e.*.Pass|
|00002830| 65 64 3a 09 09 74 68 65 | 57 69 6e 64 6f 77 50 74 |ed:..the|WindowPt|
|00002840| 72 3a 09 61 20 70 6f 69 | 6e 74 65 72 20 74 6f 20 |r:.a poi|nter to |
|00002850| 74 68 65 20 77 69 6e 64 | 6f 77 20 77 65 20 77 61 |the wind|ow we wa|
|00002860| 6e 74 20 74 6f 20 63 68 | 65 63 6b 2e 0d 2a 09 52 |nt to ch|eck..*.R|
|00002870| 65 74 75 72 6e 73 3a 09 | 49 6e 74 65 67 65 72 20 |eturns:.|Integer |
|00002880| 69 6e 64 69 63 61 74 69 | 6e 67 20 74 68 65 20 77 |indicati|ng the w|
|00002890| 69 6e 64 6f 77 20 74 79 | 70 65 2e 0d 2a 2a 2a 2a |indow ty|pe..****|
|000028a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000028b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000028c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000028d0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000028e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2f 0d 70 61 |********|****/.pa|
|000028f0| 73 63 61 6c 09 73 68 6f | 72 74 09 09 57 69 6e 64 |scal.sho|rt..Wind|
|00002900| 6f 77 54 79 70 65 28 57 | 69 6e 64 6f 77 50 74 72 |owType(W|indowPtr|
|00002910| 20 74 68 65 57 69 6e 64 | 6f 77 50 74 72 29 0d 7b | theWind|owPtr).{|
|00002920| 0d 09 73 68 6f 72 74 09 | 09 72 65 73 75 6c 74 20 |..short.|.result |
|00002930| 3d 20 6b 55 4e 4b 4e 4f | 57 4e 57 49 4e 44 4f 57 |= kUNKNO|WNWINDOW|
|00002940| 3b 0d 09 0d 09 0d 09 69 | 66 20 28 74 68 65 57 69 |;......i|f (theWi|
|00002950| 6e 64 6f 77 50 74 72 20 | 3d 3d 20 6e 69 6c 29 20 |ndowPtr |== nil) |
|00002960| 7b 0d 09 09 72 65 73 75 | 6c 74 20 3d 20 6b 4e 49 |{...resu|lt = kNI|
|00002970| 4c 57 49 4e 44 4f 57 3b | 0d 09 7d 20 65 6c 73 65 |LWINDOW;|..} else|
|00002980| 20 7b 0d 09 09 69 66 20 | 28 28 28 57 69 6e 64 6f | {...if |(((Windo|
|00002990| 77 50 65 65 6b 29 74 68 | 65 57 69 6e 64 6f 77 50 |wPeek)th|eWindowP|
|000029a0| 74 72 29 2d 3e 77 69 6e | 64 6f 77 4b 69 6e 64 20 |tr)->win|dowKind |
|000029b0| 3c 20 30 29 20 7b 0d 09 | 09 09 72 65 73 75 6c 74 |< 0) {..|..result|
|000029c0| 20 3d 20 6b 44 41 57 49 | 4e 44 4f 57 3b 0d 09 09 | = kDAWI|NDOW;...|
|000029d0| 7d 20 65 6c 73 65 20 7b | 0d 09 09 09 69 66 20 28 |} else {|....if (|
|000029e0| 28 28 41 70 70 57 69 6e | 64 6f 77 50 74 72 29 74 |((AppWin|dowPtr)t|
|000029f0| 68 65 57 69 6e 64 6f 77 | 50 74 72 29 2d 3e 66 57 |heWindow|Ptr)->fW|
|00002a00| 69 6e 64 6f 77 54 79 70 | 65 20 3d 3d 20 6b 41 50 |indowTyp|e == kAP|
|00002a10| 50 57 49 4e 44 4f 57 29 | 20 7b 0d 09 09 09 09 72 |PWINDOW)| {.....r|
|00002a20| 65 73 75 6c 74 20 3d 20 | 6b 41 50 50 57 49 4e 44 |esult = |kAPPWIND|
|00002a30| 4f 57 3b 0d 09 09 09 7d | 20 65 6c 73 65 20 7b 0d |OW;....}| else {.|
|00002a40| 09 09 09 09 72 65 73 75 | 6c 74 20 3d 20 6b 44 45 |....resu|lt = kDE|
|00002a50| 42 55 47 57 49 4e 44 4f | 57 3b 0d 09 09 09 7d 0d |BUGWINDO|W;....}.|
|00002a60| 09 09 7d 0d 09 7d 0d 09 | 0d 09 72 65 74 75 72 6e |..}..}..|..return|
|00002a70| 20 28 72 65 73 75 6c 74 | 29 3b 0d 7d 20 2f 2a 57 | (result|);.} /*W|
|00002a80| 69 6e 64 6f 77 54 79 70 | 65 2a 2f 0d 0d 0d 2f 2a |indowTyp|e*/.../*|
|00002a90| 09 43 68 61 6e 67 65 20 | 74 68 65 20 63 75 72 73 |.Change |the curs|
|00002aa0| 6f 72 27 73 20 73 68 61 | 70 65 2c 20 64 65 70 65 |or's sha|pe, depe|
|00002ab0| 6e 64 69 6e 67 20 6f 6e | 20 69 74 73 20 70 6f 73 |nding on| its pos|
|00002ac0| 69 74 69 6f 6e 2e 20 54 | 68 69 73 20 61 6c 73 6f |ition. T|his also|
|00002ad0| 20 63 61 6c 63 75 6c 61 | 74 65 73 20 74 68 65 20 | calcula|tes the |
|00002ae0| 72 65 67 69 6f 6e 0d 09 | 77 68 65 72 65 20 74 68 |region..|where th|
|00002af0| 65 20 63 75 72 72 65 6e | 74 20 63 75 72 73 6f 72 |e curren|t cursor|
|00002b00| 20 72 65 73 69 64 65 73 | 20 28 66 6f 72 20 57 61 | resides| (for Wa|
|00002b10| 69 74 4e 65 78 74 45 76 | 65 6e 74 29 2e 20 49 66 |itNextEv|ent). If|
|00002b20| 20 74 68 65 20 6d 6f 75 | 73 65 20 69 73 20 65 76 | the mou|se is ev|
|00002b30| 65 72 20 6f 75 74 73 69 | 64 65 20 6f 66 0d 09 74 |er outsi|de of..t|
|00002b40| 68 61 74 20 72 65 67 69 | 6f 6e 2c 20 61 6e 20 65 |hat regi|on, an e|
|00002b50| 76 65 6e 74 20 77 6f 75 | 6c 64 20 62 65 20 67 65 |vent wou|ld be ge|
|00002b60| 6e 65 72 61 74 65 64 2c | 20 63 61 75 73 69 6e 67 |nerated,| causing|
|00002b70| 20 74 68 69 73 20 72 6f | 75 74 69 6e 65 20 74 6f | this ro|utine to|
|00002b80| 20 62 65 20 63 61 6c 6c | 65 64 2c 0d 09 61 6c 6c | be call|ed,..all|
|00002b90| 6f 77 69 6e 67 20 75 73 | 20 74 6f 20 63 68 61 6e |owing us| to chan|
|00002ba0| 67 65 20 74 68 65 20 72 | 65 67 69 6f 6e 20 74 6f |ge the r|egion to|
|00002bb0| 20 74 68 65 20 72 65 67 | 69 6f 6e 20 74 68 65 20 | the reg|ion the |
|00002bc0| 6d 6f 75 73 65 20 69 73 | 20 63 75 72 72 65 6e 74 |mouse is| current|
|00002bd0| 6c 79 20 69 6e 2e 20 49 | 66 0d 09 74 68 65 72 65 |ly in. I|f..there|
|00002be0| 20 69 73 20 6d 6f 72 65 | 20 74 6f 20 74 68 65 20 | is more| to the |
|00002bf0| 65 76 65 6e 74 20 74 68 | 61 6e 20 6a 75 73 74 20 |event th|an just |
|00002c00| d2 74 68 65 20 6d 6f 75 | 73 65 20 6d 6f 76 65 64 |.the mou|se moved|
|00002c10| d3 2c 20 77 65 20 67 65 | 74 20 63 61 6c 6c 65 64 |., we ge|t called|
|00002c20| 20 62 65 66 6f 72 65 20 | 74 68 65 0d 09 65 76 65 | before |the..eve|
|00002c30| 6e 74 20 69 73 20 70 72 | 6f 63 65 73 73 65 64 20 |nt is pr|ocessed |
|00002c40| 74 6f 20 6d 61 6b 65 20 | 73 75 72 65 20 74 68 65 |to make |sure the|
|00002c50| 20 63 75 72 73 6f 72 20 | 69 73 20 74 68 65 20 72 | cursor |is the r|
|00002c60| 69 67 68 74 20 6f 6e 65 | 2e 20 49 6e 20 61 6e 79 |ight one|. In any|
|00002c70| 20 28 61 68 65 6d 29 20 | 65 76 65 6e 74 2c 0d 09 | (ahem) |event,..|
|00002c80| 74 68 69 73 20 69 73 20 | 63 61 6c 6c 65 64 20 61 |this is |called a|
|00002c90| 67 61 69 6e 20 62 65 66 | 6f 72 65 20 77 65 20 09 |gain bef|ore we .|
|00002ca0| 66 61 6c 6c 20 62 61 63 | 6b 20 69 6e 74 6f 20 57 |fall bac|k into W|
|00002cb0| 4e 45 2e 20 2a 2f 0d 0d | 23 70 72 61 67 6d 61 20 |NE. */..|#pragma |
|00002cc0| 73 65 67 6d 65 6e 74 20 | 4d 61 69 6e 0d 76 6f 69 |segment |Main.voi|
|00002cd0| 64 20 41 64 6a 75 73 74 | 43 75 72 73 6f 72 28 6d |d Adjust|Cursor(m|
|00002ce0| 6f 75 73 65 2c 72 65 67 | 69 6f 6e 29 0d 09 50 6f |ouse,reg|ion)..Po|
|00002cf0| 69 6e 74 09 09 6d 6f 75 | 73 65 3b 0d 09 52 67 6e |int..mou|se;..Rgn|
|00002d00| 48 61 6e 64 6c 65 09 72 | 65 67 69 6f 6e 3b 0d 7b |Handle.r|egion;.{|
|00002d10| 0d 09 57 69 6e 64 6f 77 | 50 74 72 09 77 69 6e 64 |..Window|Ptr.wind|
|00002d20| 6f 77 3b 0d 09 52 67 6e | 48 61 6e 64 6c 65 09 61 |ow;..Rgn|Handle.a|
|00002d30| 72 72 6f 77 52 67 6e 3b | 0d 09 52 67 6e 48 61 6e |rrowRgn;|..RgnHan|
|00002d40| 64 6c 65 09 70 6c 75 73 | 52 67 6e 3b 0d 09 52 65 |dle.plus|Rgn;..Re|
|00002d50| 63 74 09 09 67 6c 6f 62 | 61 6c 50 6f 72 74 52 65 |ct..glob|alPortRe|
|00002d60| 63 74 3b 0d 0d 09 77 69 | 6e 64 6f 77 20 3d 20 46 |ct;...wi|ndow = F|
|00002d70| 72 6f 6e 74 57 69 6e 64 | 6f 77 28 29 3b 09 2f 2a |rontWind|ow();./*|
|00002d80| 20 77 65 20 6f 6e 6c 79 | 20 61 64 6a 75 73 74 20 | we only| adjust |
|00002d90| 74 68 65 20 63 75 72 73 | 6f 72 20 77 68 65 6e 20 |the curs|or when |
|00002da0| 77 65 20 61 72 65 20 69 | 6e 20 66 72 6f 6e 74 20 |we are i|n front |
|00002db0| 2a 2f 0d 09 69 66 20 28 | 20 28 21 20 67 49 6e 42 |*/..if (| (! gInB|
|00002dc0| 61 63 6b 67 72 6f 75 6e | 64 29 20 26 26 20 28 21 |ackgroun|d) && (!|
|00002dd0| 20 49 73 44 41 57 69 6e | 64 6f 77 28 77 69 6e 64 | IsDAWin|dow(wind|
|00002de0| 6f 77 29 29 20 29 20 7b | 0d 09 09 2f 2a 20 63 61 |ow)) ) {|.../* ca|
|00002df0| 6c 63 75 6c 61 74 65 20 | 72 65 67 69 6f 6e 73 20 |lculate |regions |
|00002e00| 66 6f 72 20 64 69 66 66 | 65 72 65 6e 74 20 63 75 |for diff|erent cu|
|00002e10| 72 73 6f 72 20 73 68 61 | 70 65 73 20 2a 2f 0d 09 |rsor sha|pes */..|
|00002e20| 09 61 72 72 6f 77 52 67 | 6e 20 3d 20 4e 65 77 52 |.arrowRg|n = NewR|
|00002e30| 67 6e 28 29 3b 0d 09 09 | 70 6c 75 73 52 67 6e 20 |gn();...|plusRgn |
|00002e40| 3d 20 4e 65 77 52 67 6e | 28 29 3b 0d 0d 09 09 2f |= NewRgn|();..../|
|00002e50| 2a 20 73 74 61 72 74 20 | 77 69 74 68 20 61 20 62 |* start |with a b|
|00002e60| 69 67 2c 20 62 69 67 20 | 72 65 63 74 61 6e 67 75 |ig, big |rectangu|
|00002e70| 6c 61 72 20 72 65 67 69 | 6f 6e 20 2a 2f 0d 09 09 |lar regi|on */...|
|00002e80| 53 65 74 52 65 63 74 52 | 67 6e 28 61 72 72 6f 77 |SetRectR|gn(arrow|
|00002e90| 52 67 6e 2c 20 6b 45 78 | 74 72 65 6d 65 4e 65 67 |Rgn, kEx|tremeNeg|
|00002ea0| 2c 20 6b 45 78 74 72 65 | 6d 65 4e 65 67 2c 20 6b |, kExtre|meNeg, k|
|00002eb0| 45 78 74 72 65 6d 65 50 | 6f 73 2c 20 6b 45 78 74 |ExtremeP|os, kExt|
|00002ec0| 72 65 6d 65 50 6f 73 29 | 3b 0d 0d 09 09 2f 2a 20 |remePos)|;..../* |
|00002ed0| 63 61 6c 63 75 6c 61 74 | 65 20 70 6c 75 73 52 67 |calculat|e plusRg|
|00002ee0| 6e 20 2a 2f 0d 09 09 69 | 66 20 28 20 49 73 41 70 |n */...i|f ( IsAp|
|00002ef0| 70 57 69 6e 64 6f 77 28 | 77 69 6e 64 6f 77 29 20 |pWindow(|window) |
|00002f00| 29 20 7b 0d 09 09 09 53 | 65 74 50 6f 72 74 28 77 |) {....S|etPort(w|
|00002f10| 69 6e 64 6f 77 29 3b 09 | 2f 2a 20 6d 61 6b 65 20 |indow);.|/* make |
|00002f20| 61 20 67 6c 6f 62 61 6c | 20 76 65 72 73 69 6f 6e |a global| version|
|00002f30| 20 6f 66 20 74 68 65 20 | 76 69 65 77 52 65 63 74 | of the |viewRect|
|00002f40| 20 2a 2f 0d 09 09 09 53 | 65 74 4f 72 69 67 69 6e | */....S|etOrigin|
|00002f50| 28 2d 77 69 6e 64 6f 77 | 2d 3e 70 6f 72 74 42 69 |(-window|->portBi|
|00002f60| 74 73 2e 62 6f 75 6e 64 | 73 2e 6c 65 66 74 2c 20 |ts.bound|s.left, |
|00002f70| 2d 77 69 6e 64 6f 77 2d | 3e 70 6f 72 74 42 69 74 |-window-|>portBit|
|00002f80| 73 2e 62 6f 75 6e 64 73 | 2e 74 6f 70 29 3b 0d 09 |s.bounds|.top);..|
|00002f90| 09 09 67 6c 6f 62 61 6c | 50 6f 72 74 52 65 63 74 |..global|PortRect|
|00002fa0| 20 3d 20 77 69 6e 64 6f | 77 2d 3e 70 6f 72 74 52 | = windo|w->portR|
|00002fb0| 65 63 74 3b 0d 09 09 09 | 52 65 63 74 52 67 6e 28 |ect;....|RectRgn(|
|00002fc0| 70 6c 75 73 52 67 6e 2c | 20 26 67 6c 6f 62 61 6c |plusRgn,| &global|
|00002fd0| 50 6f 72 74 52 65 63 74 | 29 3b 0d 09 09 09 53 65 |PortRect|);....Se|
|00002fe0| 63 74 52 67 6e 28 70 6c | 75 73 52 67 6e 2c 20 77 |ctRgn(pl|usRgn, w|
|00002ff0| 69 6e 64 6f 77 2d 3e 76 | 69 73 52 67 6e 2c 20 70 |indow->v|isRgn, p|
|00003000| 6c 75 73 52 67 6e 29 3b | 0d 09 09 09 53 65 74 4f |lusRgn);|....SetO|
|00003010| 72 69 67 69 6e 28 30 2c | 20 30 29 3b 0d 09 09 7d |rigin(0,| 0);...}|
|00003020| 0d 0d 09 09 2f 2a 20 73 | 75 62 74 72 61 63 74 20 |..../* s|ubtract |
|00003030| 6f 74 68 65 72 20 72 65 | 67 69 6f 6e 73 20 66 72 |other re|gions fr|
|00003040| 6f 6d 20 61 72 72 6f 77 | 52 67 6e 20 2a 2f 0d 09 |om arrow|Rgn */..|
|00003050| 09 44 69 66 66 52 67 6e | 28 61 72 72 6f 77 52 67 |.DiffRgn|(arrowRg|
|00003060| 6e 2c 20 70 6c 75 73 52 | 67 6e 2c 20 61 72 72 6f |n, plusR|gn, arro|
|00003070| 77 52 67 6e 29 3b 0d 0d | 09 09 2f 2a 20 63 68 61 |wRgn);..|../* cha|
|00003080| 6e 67 65 20 74 68 65 20 | 63 75 72 73 6f 72 20 61 |nge the |cursor a|
|00003090| 6e 64 20 74 68 65 20 72 | 65 67 69 6f 6e 20 70 61 |nd the r|egion pa|
|000030a0| 72 61 6d 65 74 65 72 20 | 2a 2f 0d 09 09 69 66 20 |rameter |*/...if |
|000030b0| 28 20 50 74 49 6e 52 67 | 6e 28 6d 6f 75 73 65 2c |( PtInRg|n(mouse,|
|000030c0| 20 70 6c 75 73 52 67 6e | 29 20 29 20 7b 0d 09 09 | plusRgn|) ) {...|
|000030d0| 09 53 65 74 43 75 72 73 | 6f 72 28 2a 47 65 74 43 |.SetCurs|or(*GetC|
|000030e0| 75 72 73 6f 72 28 70 6c | 75 73 43 75 72 73 6f 72 |ursor(pl|usCursor|
|000030f0| 29 29 3b 0d 09 09 09 43 | 6f 70 79 52 67 6e 28 70 |));....C|opyRgn(p|
|00003100| 6c 75 73 52 67 6e 2c 20 | 72 65 67 69 6f 6e 29 3b |lusRgn, |region);|
|00003110| 0d 09 09 7d 20 65 6c 73 | 65 20 7b 0d 09 09 09 53 |...} els|e {....S|
|00003120| 65 74 43 75 72 73 6f 72 | 28 26 71 64 2e 61 72 72 |etCursor|(&qd.arr|
|00003130| 6f 77 29 3b 0d 09 09 09 | 43 6f 70 79 52 67 6e 28 |ow);....|CopyRgn(|
|00003140| 61 72 72 6f 77 52 67 6e | 2c 20 72 65 67 69 6f 6e |arrowRgn|, region|
|00003150| 29 3b 0d 09 09 7d 0d 0d | 09 09 2f 2a 20 67 65 74 |);...}..|../* get|
|00003160| 20 72 69 64 20 6f 66 20 | 6f 75 72 20 6c 6f 63 61 | rid of |our loca|
|00003170| 6c 20 72 65 67 69 6f 6e | 73 20 2a 2f 0d 09 09 44 |l region|s */...D|
|00003180| 69 73 70 6f 73 65 52 67 | 6e 28 61 72 72 6f 77 52 |isposeRg|n(arrowR|
|00003190| 67 6e 29 3b 0d 09 09 44 | 69 73 70 6f 73 65 52 67 |gn);...D|isposeRg|
|000031a0| 6e 28 70 6c 75 73 52 67 | 6e 29 3b 0d 09 7d 0d 7d |n(plusRg|n);..}.}|
|000031b0| 20 2f 2a 41 64 6a 75 73 | 74 43 75 72 73 6f 72 2a | /*Adjus|tCursor*|
|000031c0| 2f 0d 0d 0d 2f 2a 09 47 | 65 74 20 74 68 65 20 67 |/.../*.G|et the g|
|000031d0| 6c 6f 62 61 6c 20 63 6f | 6f 72 64 69 6e 61 74 65 |lobal co|ordinate|
|000031e0| 73 20 6f 66 20 74 68 65 | 20 6d 6f 75 73 65 2e 20 |s of the| mouse. |
|000031f0| 57 68 65 6e 20 79 6f 75 | 20 63 61 6c 6c 20 4f 53 |When you| call OS|
|00003200| 45 76 65 6e 74 41 76 61 | 69 6c 0d 09 69 74 20 77 |EventAva|il..it w|
|00003210| 69 6c 6c 20 72 65 74 75 | 72 6e 20 65 69 74 68 65 |ill retu|rn eithe|
|00003220| 72 20 61 20 70 65 6e 64 | 69 6e 67 20 65 76 65 6e |r a pend|ing even|
|00003230| 74 20 6f 72 20 61 20 6e | 75 6c 6c 20 65 76 65 6e |t or a n|ull even|
|00003240| 74 2e 20 49 6e 20 65 69 | 74 68 65 72 20 63 61 73 |t. In ei|ther cas|
|00003250| 65 2c 0d 09 74 68 65 20 | 77 68 65 72 65 20 66 69 |e,..the |where fi|
|00003260| 65 6c 64 20 6f 66 20 74 | 68 65 20 65 76 65 6e 74 |eld of t|he event|
|00003270| 20 72 65 63 6f 72 64 20 | 77 69 6c 6c 20 63 6f 6e | record |will con|
|00003280| 74 61 69 6e 20 74 68 65 | 20 63 75 72 72 65 6e 74 |tain the| current|
|00003290| 20 70 6f 73 69 74 69 6f | 6e 0d 09 6f 66 20 74 68 | positio|n..of th|
|000032a0| 65 20 6d 6f 75 73 65 20 | 69 6e 20 67 6c 6f 62 61 |e mouse |in globa|
|000032b0| 6c 20 63 6f 6f 72 64 69 | 6e 61 74 65 73 20 61 6e |l coordi|nates an|
|000032c0| 64 20 74 68 65 20 6d 6f | 64 69 66 69 65 72 73 20 |d the mo|difiers |
|000032d0| 66 69 65 6c 64 20 77 69 | 6c 6c 20 72 65 66 6c 65 |field wi|ll refle|
|000032e0| 63 74 0d 09 74 68 65 20 | 63 75 72 72 65 6e 74 20 |ct..the |current |
|000032f0| 73 74 61 74 65 20 6f 66 | 20 74 68 65 20 6d 6f 64 |state of| the mod|
|00003300| 69 66 69 65 72 73 2e 20 | 41 6e 6f 74 68 65 72 20 |ifiers. |Another |
|00003310| 77 61 79 20 74 6f 20 67 | 65 74 20 74 68 65 20 67 |way to g|et the g|
|00003320| 6c 6f 62 61 6c 0d 09 63 | 6f 6f 72 64 69 6e 61 74 |lobal..c|oordinat|
|00003330| 65 73 20 69 73 20 74 6f | 20 63 61 6c 6c 20 47 65 |es is to| call Ge|
|00003340| 74 4d 6f 75 73 65 20 61 | 6e 64 20 4c 6f 63 61 6c |tMouse a|nd Local|
|00003350| 54 6f 47 6c 6f 62 61 6c | 2c 20 62 75 74 20 74 68 |ToGlobal|, but th|
|00003360| 61 74 20 72 65 71 75 69 | 72 65 73 0d 09 62 65 69 |at requi|res..bei|
|00003370| 6e 67 20 73 75 72 65 20 | 74 68 61 74 20 74 68 65 |ng sure |that the|
|00003380| 50 6f 72 74 20 69 73 20 | 73 65 74 20 74 6f 20 61 |Port is |set to a|
|00003390| 20 76 61 6c 69 64 20 70 | 6f 72 74 2e 20 2a 2f 0d | valid p|ort. */.|
|000033a0| 0d 23 70 72 61 67 6d 61 | 20 73 65 67 6d 65 6e 74 |.#pragma| segment|
|000033b0| 20 4d 61 69 6e 0d 76 6f | 69 64 20 47 65 74 47 6c | Main.vo|id GetGl|
|000033c0| 6f 62 61 6c 4d 6f 75 73 | 65 28 6d 6f 75 73 65 29 |obalMous|e(mouse)|
|000033d0| 0d 09 50 6f 69 6e 74 09 | 2a 6d 6f 75 73 65 3b 0d |..Point.|*mouse;.|
|000033e0| 7b 0d 09 45 76 65 6e 74 | 52 65 63 6f 72 64 09 65 |{..Event|Record.e|
|000033f0| 76 65 6e 74 3b 0d 09 0d | 09 4f 53 45 76 65 6e 74 |vent;...|.OSEvent|
|00003400| 41 76 61 69 6c 28 6b 4e | 6f 45 76 65 6e 74 73 2c |Avail(kN|oEvents,|
|00003410| 20 26 65 76 65 6e 74 29 | 3b 09 2f 2a 20 77 65 20 | &event)|;./* we |
|00003420| 61 72 65 6e 27 74 20 69 | 6e 74 65 72 65 73 74 65 |aren't i|ntereste|
|00003430| 64 20 69 6e 20 61 6e 79 | 20 65 76 65 6e 74 73 20 |d in any| events |
|00003440| 2a 2f 0d 09 2a 6d 6f 75 | 73 65 20 3d 20 65 76 65 |*/..*mou|se = eve|
|00003450| 6e 74 2e 77 68 65 72 65 | 3b 09 09 09 09 2f 2a 20 |nt.where|;..../* |
|00003460| 6a 75 73 74 20 74 68 65 | 20 6d 6f 75 73 65 20 70 |just the| mouse p|
|00003470| 6f 73 69 74 69 6f 6e 20 | 2a 2f 0d 7d 20 2f 2a 47 |osition |*/.} /*G|
|00003480| 65 74 47 6c 6f 62 61 6c | 4d 6f 75 73 65 2a 2f 0d |etGlobal|Mouse*/.|
|00003490| 0d 0d 2f 2a 09 54 68 69 | 73 20 69 73 20 63 61 6c |../*.Thi|s is cal|
|000034a0| 6c 65 64 20 77 68 65 6e | 20 61 6e 20 75 70 64 61 |led when| an upda|
|000034b0| 74 65 20 65 76 65 6e 74 | 20 69 73 20 72 65 63 65 |te event| is rece|
|000034c0| 69 76 65 64 20 66 6f 72 | 20 61 20 77 69 6e 64 6f |ived for| a windo|
|000034d0| 77 2e 0d 09 49 74 20 63 | 61 6c 6c 73 20 44 72 61 |w...It c|alls Dra|
|000034e0| 77 57 69 6e 64 6f 77 20 | 74 6f 20 64 72 61 77 20 |wWindow |to draw |
|000034f0| 74 68 65 20 63 6f 6e 74 | 65 6e 74 73 20 6f 66 20 |the cont|ents of |
|00003500| 61 6e 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 77 |an appli|cation w|
|00003510| 69 6e 64 6f 77 2e 0d 09 | 41 73 20 61 6e 20 65 66 |indow...|As an ef|
|00003520| 66 65 63 69 65 6e 63 79 | 20 6d 65 61 73 75 72 65 |feciency| measure|
|00003530| 20 74 68 61 74 20 64 6f | 65 73 20 6e 6f 74 20 68 | that do|es not h|
|00003540| 61 76 65 20 74 6f 20 62 | 65 20 66 6f 6c 6c 6f 77 |ave to b|e follow|
|00003550| 65 64 2c 20 69 74 0d 09 | 63 61 6c 6c 73 20 74 68 |ed, it..|calls th|
|00003560| 65 20 64 72 61 77 69 6e | 67 20 72 6f 75 74 69 6e |e drawin|g routin|
|00003570| 65 20 6f 6e 6c 79 20 69 | 66 20 74 68 65 20 76 69 |e only i|f the vi|
|00003580| 73 52 67 6e 20 69 73 20 | 6e 6f 6e 2d 65 6d 70 74 |sRgn is |non-empt|
|00003590| 79 2e 20 54 68 69 73 0d | 09 77 69 6c 6c 20 68 61 |y. This.|.will ha|
|000035a0| 6e 64 6c 65 20 73 69 74 | 75 61 74 69 6f 6e 73 20 |ndle sit|uations |
|000035b0| 77 68 65 72 65 20 63 61 | 6c 63 75 6c 61 74 69 6f |where ca|lculatio|
|000035c0| 6e 73 20 66 6f 72 20 64 | 72 61 77 69 6e 67 20 6f |ns for d|rawing o|
|000035d0| 72 20 64 72 61 77 69 6e | 67 0d 09 69 74 73 65 6c |r drawin|g..itsel|
|000035e0| 66 20 69 73 20 76 65 72 | 79 20 74 69 6d 65 2d 63 |f is ver|y time-c|
|000035f0| 6f 6e 73 75 6d 69 6e 67 | 2e 20 2a 2f 0d 0d 23 70 |onsuming|. */..#p|
|00003600| 72 61 67 6d 61 20 73 65 | 67 6d 65 6e 74 20 4d 61 |ragma se|gment Ma|
|00003610| 69 6e 0d 76 6f 69 64 20 | 44 6f 55 70 64 61 74 65 |in.void |DoUpdate|
|00003620| 28 77 69 6e 64 6f 77 29 | 0d 09 57 69 6e 64 6f 77 |(window)|..Window|
|00003630| 50 74 72 09 77 69 6e 64 | 6f 77 3b 0d 7b 0d 09 69 |Ptr.wind|ow;.{..i|
|00003640| 66 20 28 20 49 73 41 70 | 70 57 69 6e 64 6f 77 28 |f ( IsAp|pWindow(|
|00003650| 77 69 6e 64 6f 77 29 20 | 29 20 7b 0d 09 09 42 65 |window) |) {...Be|
|00003660| 67 69 6e 55 70 64 61 74 | 65 28 77 69 6e 64 6f 77 |ginUpdat|e(window|
|00003670| 29 3b 09 09 09 09 2f 2a | 20 74 68 69 73 20 73 65 |);..../*| this se|
|00003680| 74 73 20 75 70 20 74 68 | 65 20 76 69 73 52 67 6e |ts up th|e visRgn|
|00003690| 20 2a 2f 0d 09 09 69 66 | 20 28 20 21 20 45 6d 70 | */...if| ( ! Emp|
|000036a0| 74 79 52 67 6e 28 77 69 | 6e 64 6f 77 2d 3e 76 69 |tyRgn(wi|ndow->vi|
|000036b0| 73 52 67 6e 29 20 29 09 | 2f 2a 20 64 72 61 77 20 |sRgn) ).|/* draw |
|000036c0| 69 66 20 75 70 64 61 74 | 69 6e 67 20 6e 65 65 64 |if updat|ing need|
|000036d0| 73 20 74 6f 20 62 65 20 | 64 6f 6e 65 20 2a 2f 0d |s to be |done */.|
|000036e0| 09 09 09 44 72 61 77 57 | 69 6e 64 6f 77 28 77 69 |...DrawW|indow(wi|
|000036f0| 6e 64 6f 77 29 3b 0d 09 | 09 45 6e 64 55 70 64 61 |ndow);..|.EndUpda|
|00003700| 74 65 28 77 69 6e 64 6f | 77 29 3b 0d 09 7d 0d 7d |te(windo|w);..}.}|
|00003710| 20 2f 2a 44 6f 55 70 64 | 61 74 65 2a 2f 0d 0d 0d | /*DoUpd|ate*/...|
|00003720| 2f 2a 09 54 68 69 73 20 | 69 73 20 63 61 6c 6c 65 |/*.This |is calle|
|00003730| 64 20 77 68 65 6e 20 61 | 20 77 69 6e 64 6f 77 20 |d when a| window |
|00003740| 69 73 20 61 63 74 69 76 | 61 74 65 64 20 6f 72 20 |is activ|ated or |
|00003750| 64 65 61 63 74 69 76 61 | 74 65 64 2e 0d 09 49 6e |deactiva|ted...In|
|00003760| 20 53 61 6d 70 6c 65 2c | 20 74 68 65 20 57 69 6e | Sample,| the Win|
|00003770| 64 6f 77 20 4d 61 6e 61 | 67 65 72 27 73 20 68 61 |dow Mana|ger's ha|
|00003780| 6e 64 6c 69 6e 67 20 6f | 66 20 61 63 74 69 76 61 |ndling o|f activa|
|00003790| 74 65 20 61 6e 64 0d 09 | 64 65 61 63 74 69 76 61 |te and..|deactiva|
|000037a0| 74 65 20 65 76 65 6e 74 | 73 20 69 73 20 73 75 66 |te event|s is suf|
|000037b0| 66 69 63 69 65 6e 74 2e | 20 4f 74 68 65 72 20 61 |ficient.| Other a|
|000037c0| 70 70 6c 69 63 61 74 69 | 6f 6e 73 20 6d 61 79 20 |pplicati|ons may |
|000037d0| 68 61 76 65 0d 09 54 65 | 78 74 45 64 69 74 20 72 |have..Te|xtEdit r|
|000037e0| 65 63 6f 72 64 73 2c 20 | 63 6f 6e 74 72 6f 6c 73 |ecords, |controls|
|000037f0| 2c 20 6c 69 73 74 73 2c | 20 65 74 63 2e 2c 20 74 |, lists,| etc., t|
|00003800| 6f 20 61 63 74 69 76 61 | 74 65 2f 64 65 61 63 74 |o activa|te/deact|
|00003810| 69 76 61 74 65 2e 20 2a | 2f 0d 0d 23 70 72 61 67 |ivate. *|/..#prag|
|00003820| 6d 61 20 73 65 67 6d 65 | 6e 74 20 4d 61 69 6e 0d |ma segme|nt Main.|
|00003830| 76 6f 69 64 20 44 6f 41 | 63 74 69 76 61 74 65 28 |void DoA|ctivate(|
|00003840| 57 69 6e 64 6f 77 50 74 | 72 20 77 69 6e 64 6f 77 |WindowPt|r window|
|00003850| 2c 20 42 6f 6f 6c 65 61 | 6e 20 62 65 63 6f 6d 69 |, Boolea|n becomi|
|00003860| 6e 67 41 63 74 69 76 65 | 29 0d 7b 0d 09 69 66 20 |ngActive|).{..if |
|00003870| 28 20 49 73 41 70 70 57 | 69 6e 64 6f 77 28 77 69 |( IsAppW|indow(wi|
|00003880| 6e 64 6f 77 29 20 29 20 | 7b 0d 09 09 69 66 20 28 |ndow) ) |{...if (|
|00003890| 20 62 65 63 6f 6d 69 6e | 67 41 63 74 69 76 65 20 | becomin|gActive |
|000038a0| 29 0d 09 09 09 2f 2a 20 | 64 6f 20 77 68 61 74 65 |)..../* |do whate|
|000038b0| 76 65 72 20 79 6f 75 20 | 6e 65 65 64 20 74 6f 20 |ver you |need to |
|000038c0| 61 74 20 61 63 74 69 76 | 61 74 69 6f 6e 20 2a 2f |at activ|ation */|
|000038d0| 20 3b 0d 09 09 65 6c 73 | 65 0d 09 09 09 2f 2a 20 | ;...els|e..../* |
|000038e0| 64 6f 20 77 68 61 74 65 | 76 65 72 20 79 6f 75 20 |do whate|ver you |
|000038f0| 6e 65 65 64 20 74 6f 20 | 61 74 20 64 65 61 63 74 |need to |at deact|
|00003900| 69 76 61 74 69 6f 6e 20 | 2a 2f 20 3b 0d 09 7d 0d |ivation |*/ ;..}.|
|00003910| 7d 20 2f 2a 44 6f 41 63 | 74 69 76 61 74 65 2a 2f |} /*DoAc|tivate*/|
|00003920| 0d 0d 0d 2f 2a 09 54 68 | 69 73 20 69 73 20 63 61 |.../*.Th|is is ca|
|00003930| 6c 6c 65 64 20 77 68 65 | 6e 20 61 20 6d 6f 75 73 |lled whe|n a mous|
|00003940| 65 2d 64 6f 77 6e 20 65 | 76 65 6e 74 20 6f 63 63 |e-down e|vent occ|
|00003950| 75 72 73 20 69 6e 20 74 | 68 65 20 63 6f 6e 74 65 |urs in t|he conte|
|00003960| 6e 74 20 6f 66 20 61 20 | 77 69 6e 64 6f 77 2e 0d |nt of a |window..|
|00003970| 09 4f 74 68 65 72 20 61 | 70 70 6c 69 63 61 74 69 |.Other a|pplicati|
|00003980| 6f 6e 73 20 6d 69 67 68 | 74 20 77 61 6e 74 20 74 |ons migh|t want t|
|00003990| 6f 20 63 61 6c 6c 20 46 | 69 6e 64 43 6f 6e 74 72 |o call F|indContr|
|000039a0| 6f 6c 2c 20 54 45 43 6c | 69 63 6b 2c 20 65 74 63 |ol, TECl|ick, etc|
|000039b0| 2e 2c 20 74 6f 0d 09 66 | 75 72 74 68 65 72 20 70 |., to..f|urther p|
|000039c0| 72 6f 63 65 73 73 20 74 | 68 65 20 63 6c 69 63 6b |rocess t|he click|
|000039d0| 2e 20 2a 2f 0d 0d 23 70 | 72 61 67 6d 61 20 73 65 |. */..#p|ragma se|
|000039e0| 67 6d 65 6e 74 20 4d 61 | 69 6e 0d 76 6f 69 64 20 |gment Ma|in.void |
|000039f0| 44 6f 43 6f 6e 74 65 6e | 74 43 6c 69 63 6b 28 77 |DoConten|tClick(w|
|00003a00| 69 6e 64 6f 77 29 0d 09 | 57 69 6e 64 6f 77 50 74 |indow)..|WindowPt|
|00003a10| 72 09 77 69 6e 64 6f 77 | 3b 0d 7b 0d 09 53 65 74 |r.window|;.{..Set|
|00003a20| 4c 69 67 68 74 28 77 69 | 6e 64 6f 77 2c 20 21 20 |Light(wi|ndow, ! |
|00003a30| 67 53 74 6f 70 70 65 64 | 29 3b 0d 7d 20 2f 2a 44 |gStopped|);.} /*D|
|00003a40| 6f 43 6f 6e 74 65 6e 74 | 43 6c 69 63 6b 2a 2f 0d |oContent|Click*/.|
|00003a50| 0d 0d 2f 2a 20 44 72 61 | 77 20 74 68 65 20 63 6f |../* Dra|w the co|
|00003a60| 6e 74 65 6e 74 73 20 6f | 66 20 74 68 65 20 61 70 |ntents o|f the ap|
|00003a70| 70 6c 69 63 61 74 69 6f | 6e 20 77 69 6e 64 6f 77 |plicatio|n window|
|00003a80| 2e 20 57 65 20 64 6f 20 | 73 6f 6d 65 20 64 72 61 |. We do |some dra|
|00003a90| 77 69 6e 67 20 69 6e 20 | 63 6f 6c 6f 72 2c 20 75 |wing in |color, u|
|00003aa0| 73 69 6e 67 0d 20 20 20 | 43 6c 61 73 73 69 63 20 |sing. |Classic |
|00003ab0| 51 75 69 63 6b 44 72 61 | 77 27 73 20 63 6f 6c 6f |QuickDra|w's colo|
|00003ac0| 72 20 63 61 70 61 62 69 | 6c 69 74 69 65 73 2e 20 |r capabi|lities. |
|00003ad0| 54 68 69 73 20 77 69 6c | 6c 20 62 65 20 62 6c 61 |This wil|l be bla|
|00003ae0| 63 6b 20 61 6e 64 20 77 | 68 69 74 65 20 6f 6e 20 |ck and w|hite on |
|00003af0| 6f 6c 64 0d 20 20 20 6d | 61 63 68 69 6e 65 73 2c |old. m|achines,|
|00003b00| 20 62 75 74 20 63 6f 6c | 6f 72 20 6f 6e 20 63 6f | but col|or on co|
|00003b10| 6c 6f 72 20 6d 61 63 68 | 69 6e 65 73 2e 20 41 74 |lor mach|ines. At|
|00003b20| 20 74 68 69 73 20 70 6f | 69 6e 74 2c 20 74 68 65 | this po|int, the|
|00003b30| 20 77 69 6e 64 6f 77 d5 | 73 20 76 69 73 52 67 6e | window.|s visRgn|
|00003b40| 0d 20 20 20 69 73 20 73 | 65 74 20 74 6f 20 61 6c |. is s|et to al|
|00003b50| 6c 6f 77 20 64 72 61 77 | 69 6e 67 20 6f 6e 6c 79 |low draw|ing only|
|00003b60| 20 77 68 65 72 65 20 69 | 74 20 6e 65 65 64 73 20 | where i|t needs |
|00003b70| 74 6f 20 62 65 20 64 6f | 6e 65 2e 20 2a 2f 0d 0d |to be do|ne. */..|
|00003b80| 23 70 72 61 67 6d 61 20 | 73 65 67 6d 65 6e 74 20 |#pragma |segment |
|00003b90| 4d 61 69 6e 0d 76 6f 69 | 64 20 44 72 61 77 57 69 |Main.voi|d DrawWi|
|00003ba0| 6e 64 6f 77 28 77 69 6e | 64 6f 77 29 0d 09 57 69 |ndow(win|dow)..Wi|
|00003bb0| 6e 64 6f 77 50 74 72 09 | 77 69 6e 64 6f 77 3b 0d |ndowPtr.|window;.|
|00003bc0| 7b 0d 09 53 65 74 50 6f | 72 74 28 77 69 6e 64 6f |{..SetPo|rt(windo|
|00003bd0| 77 29 3b 0d 0d 09 45 72 | 61 73 65 52 65 63 74 28 |w);...Er|aseRect(|
|00003be0| 26 77 69 6e 64 6f 77 2d | 3e 70 6f 72 74 52 65 63 |&window-|>portRec|
|00003bf0| 74 29 3b 09 2f 2a 20 63 | 6c 65 61 72 20 6f 75 74 |t);./* c|lear out|
|00003c00| 20 61 6e 79 20 67 61 72 | 62 61 67 65 20 74 68 61 | any gar|bage tha|
|00003c10| 74 20 6d 61 79 20 6c 69 | 6e 67 65 72 20 2a 2f 0d |t may li|nger */.|
|00003c20| 09 69 66 20 28 20 67 53 | 74 6f 70 70 65 64 20 29 |.if ( gS|topped )|
|00003c30| 09 09 09 09 09 2f 2a 20 | 64 72 61 77 20 61 20 72 |...../* |draw a r|
|00003c40| 65 64 20 28 6f 72 20 77 | 68 69 74 65 29 20 73 74 |ed (or w|hite) st|
|00003c50| 6f 70 20 6c 69 67 68 74 | 20 2a 2f 0d 09 09 46 6f |op light| */...Fo|
|00003c60| 72 65 43 6f 6c 6f 72 28 | 72 65 64 43 6f 6c 6f 72 |reColor(|redColor|
|00003c70| 29 3b 0d 09 65 6c 73 65 | 0d 09 09 46 6f 72 65 43 |);..else|...ForeC|
|00003c80| 6f 6c 6f 72 28 77 68 69 | 74 65 43 6f 6c 6f 72 29 |olor(whi|teColor)|
|00003c90| 3b 0d 09 50 61 69 6e 74 | 4f 76 61 6c 28 26 67 53 |;..Paint|Oval(&gS|
|00003ca0| 74 6f 70 52 65 63 74 29 | 3b 0d 09 46 6f 72 65 43 |topRect)|;..ForeC|
|00003cb0| 6f 6c 6f 72 28 62 6c 61 | 63 6b 43 6f 6c 6f 72 29 |olor(bla|ckColor)|
|00003cc0| 3b 0d 09 46 72 61 6d 65 | 4f 76 61 6c 28 26 67 53 |;..Frame|Oval(&gS|
|00003cd0| 74 6f 70 52 65 63 74 29 | 3b 0d 09 69 66 20 28 20 |topRect)|;..if ( |
|00003ce0| 21 20 67 53 74 6f 70 70 | 65 64 20 29 09 09 09 09 |! gStopp|ed )....|
|00003cf0| 2f 2a 20 64 72 61 77 20 | 61 20 67 72 65 65 6e 20 |/* draw |a green |
|00003d00| 28 6f 72 20 77 68 69 74 | 65 29 20 67 6f 20 6c 69 |(or whit|e) go li|
|00003d10| 67 68 74 20 2a 2f 0d 09 | 09 46 6f 72 65 43 6f 6c |ght */..|.ForeCol|
|00003d20| 6f 72 28 67 72 65 65 6e | 43 6f 6c 6f 72 29 3b 0d |or(green|Color);.|
|00003d30| 09 65 6c 73 65 0d 09 09 | 46 6f 72 65 43 6f 6c 6f |.else...|ForeColo|
|00003d40| 72 28 77 68 69 74 65 43 | 6f 6c 6f 72 29 3b 0d 09 |r(whiteC|olor);..|
|00003d50| 50 61 69 6e 74 4f 76 61 | 6c 28 26 67 47 6f 52 65 |PaintOva|l(&gGoRe|
|00003d60| 63 74 29 3b 0d 09 46 6f | 72 65 43 6f 6c 6f 72 28 |ct);..Fo|reColor(|
|00003d70| 62 6c 61 63 6b 43 6f 6c | 6f 72 29 3b 0d 09 46 72 |blackCol|or);..Fr|
|00003d80| 61 6d 65 4f 76 61 6c 28 | 26 67 47 6f 52 65 63 74 |ameOval(|&gGoRect|
|00003d90| 29 3b 0d 7d 20 2f 2a 44 | 72 61 77 57 69 6e 64 6f |);.} /*D|rawWindo|
|00003da0| 77 2a 2f 0d 0d 0d 2f 2a | 09 45 6e 61 62 6c 65 20 |w*/.../*|.Enable |
|00003db0| 61 6e 64 20 64 69 73 61 | 62 6c 65 20 6d 65 6e 75 |and disa|ble menu|
|00003dc0| 73 20 62 61 73 65 64 20 | 6f 6e 20 74 68 65 20 63 |s based |on the c|
|00003dd0| 75 72 72 65 6e 74 20 73 | 74 61 74 65 2e 0d 09 54 |urrent s|tate...T|
|00003de0| 68 65 20 75 73 65 72 20 | 63 61 6e 20 6f 6e 6c 79 |he user |can only|
|00003df0| 20 73 65 6c 65 63 74 20 | 65 6e 61 62 6c 65 64 20 | select |enabled |
|00003e00| 6d 65 6e 75 20 69 74 65 | 6d 73 2e 20 57 65 20 73 |menu ite|ms. We s|
|00003e10| 65 74 20 75 70 20 61 6c | 6c 20 74 68 65 20 6d 65 |et up al|l the me|
|00003e20| 6e 75 20 69 74 65 6d 73 | 0d 09 62 65 66 6f 72 65 |nu items|..before|
|00003e30| 20 63 61 6c 6c 69 6e 67 | 20 4d 65 6e 75 53 65 6c | calling| MenuSel|
|00003e40| 65 63 74 20 6f 72 20 4d | 65 6e 75 4b 65 79 2c 20 |ect or M|enuKey, |
|00003e50| 73 69 6e 63 65 20 74 68 | 65 73 65 20 61 72 65 20 |since th|ese are |
|00003e60| 74 68 65 20 6f 6e 6c 79 | 20 74 69 6d 65 73 20 74 |the only| times t|
|00003e70| 68 61 74 0d 09 61 20 6d | 65 6e 75 20 69 74 65 6d |hat..a m|enu item|
|00003e80| 20 63 61 6e 20 62 65 20 | 73 65 6c 65 63 74 65 64 | can be |selected|
|00003e90| 2e 20 4e 6f 74 65 20 74 | 68 61 74 20 4d 65 6e 75 |. Note t|hat Menu|
|00003ea0| 53 65 6c 65 63 74 20 69 | 73 20 61 6c 73 6f 20 74 |Select i|s also t|
|00003eb0| 68 65 20 6f 6e 6c 79 20 | 74 69 6d 65 0d 09 74 68 |he only |time..th|
|00003ec0| 65 20 75 73 65 72 20 77 | 69 6c 6c 20 73 65 65 20 |e user w|ill see |
|00003ed0| 6d 65 6e 75 20 69 74 65 | 6d 73 2e 20 54 68 69 73 |menu ite|ms. This|
|00003ee0| 20 61 70 70 72 6f 61 63 | 68 20 74 6f 20 64 65 63 | approac|h to dec|
|00003ef0| 69 64 69 6e 67 20 77 68 | 61 74 20 65 6e 61 62 6c |iding wh|at enabl|
|00003f00| 65 2f 0d 09 64 69 73 61 | 62 6c 65 20 73 74 61 74 |e/..disa|ble stat|
|00003f10| 65 20 61 20 6d 65 6e 75 | 20 69 74 65 6d 20 68 61 |e a menu| item ha|
|00003f20| 73 20 74 68 65 20 61 64 | 76 61 6e 74 61 67 65 20 |s the ad|vantage |
|00003f30| 6f 66 20 63 6f 6e 63 65 | 6e 74 72 61 74 69 6e 67 |of conce|ntrating|
|00003f40| 20 61 6c 6c 0d 09 74 68 | 65 20 64 65 63 69 73 69 | all..th|e decisi|
|00003f50| 6f 6e 2d 6d 61 6b 69 6e | 67 20 69 6e 20 6f 6e 65 |on-makin|g in one|
|00003f60| 20 72 6f 75 74 69 6e 65 | 2c 20 61 73 20 6f 70 70 | routine|, as opp|
|00003f70| 6f 73 65 64 20 74 6f 20 | 62 65 69 6e 67 20 73 70 |osed to |being sp|
|00003f80| 72 65 61 64 20 74 68 72 | 6f 75 67 68 6f 75 74 0d |read thr|oughout.|
|00003f90| 09 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |.the app|lication|
|00003fa0| 2e 20 4f 74 68 65 72 20 | 61 70 70 6c 69 63 61 74 |. Other |applicat|
|00003fb0| 69 6f 6e 20 64 65 73 69 | 67 6e 73 20 6d 61 79 20 |ion desi|gns may |
|00003fc0| 74 61 6b 65 20 61 20 64 | 69 66 66 65 72 65 6e 74 |take a d|ifferent|
|00003fd0| 20 61 70 70 72 6f 61 63 | 68 0d 09 74 68 61 74 20 | approac|h..that |
|00003fe0| 69 73 20 6a 75 73 74 20 | 61 73 20 76 61 6c 69 64 |is just |as valid|
|00003ff0| 2e 20 2a 2f 0d 0d 23 70 | 72 61 67 6d 61 20 73 65 |. */..#p|ragma se|
|00004000| 67 6d 65 6e 74 20 4d 61 | 69 6e 0d 76 6f 69 64 20 |gment Ma|in.void |
|00004010| 41 64 6a 75 73 74 4d 65 | 6e 75 73 28 29 0d 7b 0d |AdjustMe|nus().{.|
|00004020| 09 57 69 6e 64 6f 77 50 | 74 72 09 77 69 6e 64 6f |.WindowP|tr.windo|
|00004030| 77 3b 0d 09 4d 65 6e 75 | 48 61 6e 64 6c 65 09 6d |w;..Menu|Handle.m|
|00004040| 65 6e 75 3b 0d 0d 09 77 | 69 6e 64 6f 77 20 3d 20 |enu;...w|indow = |
|00004050| 46 72 6f 6e 74 57 69 6e | 64 6f 77 28 29 3b 0d 0d |FrontWin|dow();..|
|00004060| 09 6d 65 6e 75 20 3d 20 | 47 65 74 4d 48 61 6e 64 |.menu = |GetMHand|
|00004070| 6c 65 28 6d 46 69 6c 65 | 29 3b 0d 09 69 66 20 28 |le(mFile|);..if (|
|00004080| 20 49 73 44 41 57 69 6e | 64 6f 77 28 77 69 6e 64 | IsDAWin|dow(wind|
|00004090| 6f 77 29 20 29 09 09 2f | 2a 20 77 65 20 63 61 6e |ow) )../|* we can|
|000040a0| 20 61 6c 6c 6f 77 20 64 | 65 73 6b 20 61 63 63 65 | allow d|esk acce|
|000040b0| 73 73 6f 72 69 65 73 20 | 74 6f 20 62 65 20 63 6c |ssories |to be cl|
|000040c0| 6f 73 65 64 20 66 72 6f | 6d 20 74 68 65 20 6d 65 |osed fro|m the me|
|000040d0| 6e 75 20 2a 2f 0d 09 09 | 45 6e 61 62 6c 65 49 74 |nu */...|EnableIt|
|000040e0| 65 6d 28 6d 65 6e 75 2c | 20 69 43 6c 6f 73 65 29 |em(menu,| iClose)|
|000040f0| 3b 0d 09 65 6c 73 65 0d | 09 09 44 69 73 61 62 6c |;..else.|..Disabl|
|00004100| 65 49 74 65 6d 28 6d 65 | 6e 75 2c 20 69 43 6c 6f |eItem(me|nu, iClo|
|00004110| 73 65 29 3b 09 2f 2a 20 | 62 75 74 20 6e 6f 74 20 |se);./* |but not |
|00004120| 6f 75 72 20 74 72 61 66 | 66 69 63 20 6c 69 67 68 |our traf|fic ligh|
|00004130| 74 20 77 69 6e 64 6f 77 | 20 2a 2f 0d 0d 09 6d 65 |t window| */...me|
|00004140| 6e 75 20 3d 20 47 65 74 | 4d 48 61 6e 64 6c 65 28 |nu = Get|MHandle(|
|00004150| 6d 45 64 69 74 29 3b 0d | 09 69 66 20 28 20 49 73 |mEdit);.|.if ( Is|
|00004160| 44 41 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 29 |DAWindow|(window)|
|00004170| 20 29 20 7b 09 09 2f 2a | 20 61 20 64 65 73 6b 20 | ) {../*| a desk |
|00004180| 61 63 63 65 73 73 6f 72 | 79 20 6d 69 67 68 74 20 |accessor|y might |
|00004190| 6e 65 65 64 20 74 68 65 | 20 65 64 69 74 20 6d 65 |need the| edit me|
|000041a0| 6e 75 c9 20 2a 2f 0d 09 | 09 45 6e 61 62 6c 65 49 |nu. */..|.EnableI|
|000041b0| 74 65 6d 28 6d 65 6e 75 | 2c 20 69 55 6e 64 6f 29 |tem(menu|, iUndo)|
|000041c0| 3b 0d 09 09 45 6e 61 62 | 6c 65 49 74 65 6d 28 6d |;...Enab|leItem(m|
|000041d0| 65 6e 75 2c 20 69 43 75 | 74 29 3b 0d 09 09 45 6e |enu, iCu|t);...En|
|000041e0| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|000041f0| 43 6f 70 79 29 3b 0d 09 | 09 45 6e 61 62 6c 65 49 |Copy);..|.EnableI|
|00004200| 74 65 6d 28 6d 65 6e 75 | 2c 20 69 43 6c 65 61 72 |tem(menu|, iClear|
|00004210| 29 3b 0d 09 09 45 6e 61 | 62 6c 65 49 74 65 6d 28 |);...Ena|bleItem(|
|00004220| 6d 65 6e 75 2c 20 69 50 | 61 73 74 65 29 3b 0d 09 |menu, iP|aste);..|
|00004230| 7d 20 65 6c 73 65 20 7b | 09 09 09 09 09 09 2f 2a |} else {|....../*|
|00004240| 20 c9 62 75 74 20 77 65 | 20 64 6f 6e d5 74 20 75 | .but we| don.t u|
|00004250| 73 65 20 69 74 20 2a 2f | 0d 09 09 44 69 73 61 62 |se it */|...Disab|
|00004260| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 55 6e |leItem(m|enu, iUn|
|00004270| 64 6f 29 3b 0d 09 09 44 | 69 73 61 62 6c 65 49 74 |do);...D|isableIt|
|00004280| 65 6d 28 6d 65 6e 75 2c | 20 69 43 75 74 29 3b 0d |em(menu,| iCut);.|
|00004290| 09 09 44 69 73 61 62 6c | 65 49 74 65 6d 28 6d 65 |..Disabl|eItem(me|
|000042a0| 6e 75 2c 20 69 43 6f 70 | 79 29 3b 0d 09 09 44 69 |nu, iCop|y);...Di|
|000042b0| 73 61 62 6c 65 49 74 65 | 6d 28 6d 65 6e 75 2c 20 |sableIte|m(menu, |
|000042c0| 69 43 6c 65 61 72 29 3b | 0d 09 09 44 69 73 61 62 |iClear);|...Disab|
|000042d0| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 50 61 |leItem(m|enu, iPa|
|000042e0| 73 74 65 29 3b 0d 09 7d | 0d 0d 09 6d 65 6e 75 20 |ste);..}|...menu |
|000042f0| 3d 20 47 65 74 4d 48 61 | 6e 64 6c 65 28 6d 4c 69 |= GetMHa|ndle(mLi|
|00004300| 67 68 74 29 3b 0d 09 09 | 2f 2f 74 68 65 20 57 69 |ght);...|//the Wi|
|00004310| 6e 64 6f 77 54 79 70 65 | 20 72 6f 75 74 69 6e 65 |ndowType| routine|
|00004320| 20 69 73 20 75 73 65 64 | 20 68 65 72 65 20 69 6e | is used| here in|
|00004330| 73 74 65 61 64 20 6f 66 | 20 49 73 41 70 70 57 69 |stead of| IsAppWi|
|00004340| 6e 64 6f 77 20 62 65 63 | 61 75 73 65 20 69 74 20 |ndow bec|ause it |
|00004350| 61 6c 73 6f 0d 09 09 2f | 2f 09 74 65 6c 6c 73 20 |also.../|/.tells |
|00004360| 75 73 20 69 66 20 74 68 | 65 72 65 27 73 20 61 20 |us if th|ere's a |
|00004370| 64 65 62 75 67 20 77 69 | 6e 64 6f 77 20 70 72 65 |debug wi|ndow pre|
|00004380| 73 65 6e 74 2e 0d 09 69 | 66 20 28 6b 41 50 50 57 |sent...i|f (kAPPW|
|00004390| 49 4e 44 4f 57 20 3d 3d | 20 57 69 6e 64 6f 77 54 |INDOW ==| WindowT|
|000043a0| 79 70 65 28 77 69 6e 64 | 6f 77 29 29 20 7b 09 2f |ype(wind|ow)) {./|
|000043b0| 2a 20 77 65 20 6b 6e 6f | 77 20 74 68 61 74 20 69 |* we kno|w that i|
|000043c0| 74 20 6d 75 73 74 20 62 | 65 20 74 68 65 20 74 72 |t must b|e the tr|
|000043d0| 61 66 66 69 63 20 6c 69 | 67 68 74 20 2a 2f 0d 09 |affic li|ght */..|
|000043e0| 09 45 6e 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |.EnableI|tem(menu|
|000043f0| 2c 20 69 53 74 6f 70 29 | 3b 0d 09 09 45 6e 61 62 |, iStop)|;...Enab|
|00004400| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 47 6f |leItem(m|enu, iGo|
|00004410| 29 3b 0d 09 7d 20 65 6c | 73 65 20 7b 0d 09 09 44 |);..} el|se {...D|
|00004420| 69 73 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |isableIt|em(menu,|
|00004430| 20 69 53 74 6f 70 29 3b | 0d 09 09 44 69 73 61 62 | iStop);|...Disab|
|00004440| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 47 6f |leItem(m|enu, iGo|
|00004450| 29 3b 0d 09 7d 0d 09 43 | 68 65 63 6b 49 74 65 6d |);..}..C|heckItem|
|00004460| 28 6d 65 6e 75 2c 20 69 | 53 74 6f 70 2c 20 67 53 |(menu, i|Stop, gS|
|00004470| 74 6f 70 70 65 64 29 3b | 20 2f 2a 20 77 65 20 63 |topped);| /* we c|
|00004480| 61 6e 20 61 6c 73 6f 20 | 64 65 74 65 72 6d 69 6e |an also |determin|
|00004490| 65 20 63 68 65 63 6b 2f | 75 6e 63 68 65 63 6b 20 |e check/|uncheck |
|000044a0| 73 74 61 74 65 2c 20 74 | 6f 6f 20 2a 2f 0d 09 43 |state, t|oo */..C|
|000044b0| 68 65 63 6b 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |heckItem|(menu, i|
|000044c0| 47 6f 2c 20 21 20 67 53 | 74 6f 70 70 65 64 29 3b |Go, ! gS|topped);|
|000044d0| 0d 09 0d 09 69 66 20 28 | 6b 44 45 42 55 47 57 49 |....if (|kDEBUGWI|
|000044e0| 4e 44 4f 57 20 3d 3d 20 | 57 69 6e 64 6f 77 54 79 |NDOW == |WindowTy|
|000044f0| 70 65 28 77 69 6e 64 6f | 77 29 29 20 7b 0d 09 09 |pe(windo|w)) {...|
|00004500| 45 6e 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |EnableIt|em(menu,|
|00004510| 20 69 46 69 6c 6c 29 3b | 0d 09 7d 20 65 6c 73 65 | iFill);|..} else|
|00004520| 20 7b 0d 09 09 44 69 73 | 61 62 6c 65 49 74 65 6d | {...Dis|ableItem|
|00004530| 28 6d 65 6e 75 2c 20 69 | 46 69 6c 6c 29 3b 0d 09 |(menu, i|Fill);..|
|00004540| 7d 0d 7d 20 2f 2a 41 64 | 6a 75 73 74 4d 65 6e 75 |}.} /*Ad|justMenu|
|00004550| 73 2a 2f 0d 0d 0d 2f 2a | 09 54 68 69 73 20 69 73 |s*/.../*|.This is|
|00004560| 20 63 61 6c 6c 65 64 20 | 77 68 65 6e 20 61 6e 20 | called |when an |
|00004570| 69 74 65 6d 20 69 73 20 | 63 68 6f 73 65 6e 20 66 |item is |chosen f|
|00004580| 72 6f 6d 20 74 68 65 20 | 6d 65 6e 75 20 62 61 72 |rom the |menu bar|
|00004590| 20 28 61 66 74 65 72 20 | 63 61 6c 6c 69 6e 67 0d | (after |calling.|
|000045a0| 09 4d 65 6e 75 53 65 6c | 65 63 74 20 6f 72 20 4d |.MenuSel|ect or M|
|000045b0| 65 6e 75 4b 65 79 29 2e | 20 49 74 20 70 65 72 66 |enuKey).| It perf|
|000045c0| 6f 72 6d 73 20 74 68 65 | 20 72 69 67 68 74 20 6f |orms the| right o|
|000045d0| 70 65 72 61 74 69 6f 6e | 20 66 6f 72 20 65 61 63 |peration| for eac|
|000045e0| 68 20 63 6f 6d 6d 61 6e | 64 2e 0d 09 49 74 20 69 |h comman|d...It i|
|000045f0| 73 20 67 6f 6f 64 20 74 | 6f 20 68 61 76 65 20 62 |s good t|o have b|
|00004600| 6f 74 68 20 74 68 65 20 | 72 65 73 75 6c 74 20 6f |oth the |result o|
|00004610| 66 20 4d 65 6e 75 53 65 | 6c 65 63 74 20 61 6e 64 |f MenuSe|lect and|
|00004620| 20 4d 65 6e 75 4b 65 79 | 20 67 6f 20 74 6f 0d 09 | MenuKey| go to..|
|00004630| 6f 6e 65 20 72 6f 75 74 | 69 6e 65 20 6c 69 6b 65 |one rout|ine like|
|00004640| 20 74 68 69 73 20 74 6f | 20 6b 65 65 70 20 65 76 | this to| keep ev|
|00004650| 65 72 79 74 68 69 6e 67 | 20 6f 72 67 61 6e 69 7a |erything| organiz|
|00004660| 65 64 2e 20 2a 2f 0d 0d | 23 70 72 61 67 6d 61 20 |ed. */..|#pragma |
|00004670| 73 65 67 6d 65 6e 74 20 | 4d 61 69 6e 0d 76 6f 69 |segment |Main.voi|
|00004680| 64 20 44 6f 4d 65 6e 75 | 43 6f 6d 6d 61 6e 64 28 |d DoMenu|Command(|
|00004690| 6d 65 6e 75 52 65 73 75 | 6c 74 29 0d 09 6c 6f 6e |menuResu|lt)..lon|
|000046a0| 67 09 09 6d 65 6e 75 52 | 65 73 75 6c 74 3b 0d 7b |g..menuR|esult;.{|
|000046b0| 0d 09 73 68 6f 72 74 09 | 09 6d 65 6e 75 49 44 3b |..short.|.menuID;|
|000046c0| 09 09 09 09 2f 2a 20 74 | 68 65 20 72 65 73 6f 75 |..../* t|he resou|
|000046d0| 72 63 65 20 49 44 20 6f | 66 20 74 68 65 20 73 65 |rce ID o|f the se|
|000046e0| 6c 65 63 74 65 64 20 6d | 65 6e 75 20 2a 2f 0d 09 |lected m|enu */..|
|000046f0| 73 68 6f 72 74 09 09 6d | 65 6e 75 49 74 65 6d 3b |short..m|enuItem;|
|00004700| 09 09 09 2f 2a 20 74 68 | 65 20 69 74 65 6d 20 6e |.../* th|e item n|
|00004710| 75 6d 62 65 72 20 6f 66 | 20 74 68 65 20 73 65 6c |umber of| the sel|
|00004720| 65 63 74 65 64 20 6d 65 | 6e 75 20 2a 2f 0d 09 73 |ected me|nu */..s|
|00004730| 68 6f 72 74 09 09 69 74 | 65 6d 48 69 74 3b 0d 09 |hort..it|emHit;..|
|00004740| 53 74 72 32 35 35 09 09 | 64 61 4e 61 6d 65 3b 0d |Str255..|daName;.|
|00004750| 09 73 68 6f 72 74 09 09 | 64 61 52 65 66 4e 75 6d |.short..|daRefNum|
|00004760| 3b 0d 09 42 6f 6f 6c 65 | 61 6e 09 09 68 61 6e 64 |;..Boole|an..hand|
|00004770| 6c 65 64 42 79 44 41 3b | 0d 0d 09 6d 65 6e 75 49 |ledByDA;|...menuI|
|00004780| 44 20 3d 20 48 69 57 6f | 72 64 28 6d 65 6e 75 52 |D = HiWo|rd(menuR|
|00004790| 65 73 75 6c 74 29 3b 09 | 2f 2a 20 75 73 65 20 6d |esult);.|/* use m|
|000047a0| 61 63 72 6f 73 20 66 6f | 72 20 65 66 66 69 63 69 |acros fo|r effici|
|000047b0| 65 6e 63 79 20 74 6f 2e | 2e 2e 20 2a 2f 0d 09 6d |ency to.|.. */..m|
|000047c0| 65 6e 75 49 74 65 6d 20 | 3d 20 4c 6f 57 6f 72 64 |enuItem |= LoWord|
|000047d0| 28 6d 65 6e 75 52 65 73 | 75 6c 74 29 3b 09 2f 2a |(menuRes|ult);./*|
|000047e0| 20 67 65 74 20 6d 65 6e | 75 20 69 74 65 6d 20 6e | get men|u item n|
|000047f0| 75 6d 62 65 72 20 61 6e | 64 20 6d 65 6e 75 20 6e |umber an|d menu n|
|00004800| 75 6d 62 65 72 20 2a 2f | 0d 09 73 77 69 74 63 68 |umber */|..switch|
|00004810| 20 28 20 6d 65 6e 75 49 | 44 20 29 20 7b 0d 09 09 | ( menuI|D ) {...|
|00004820| 63 61 73 65 20 6d 41 70 | 70 6c 65 3a 0d 09 09 09 |case mAp|ple:....|
|00004830| 73 77 69 74 63 68 20 28 | 20 6d 65 6e 75 49 74 65 |switch (| menuIte|
|00004840| 6d 20 29 20 7b 0d 09 09 | 09 09 63 61 73 65 20 69 |m ) {...|..case i|
|00004850| 41 62 6f 75 74 3a 09 09 | 2f 2a 20 62 72 69 6e 67 |About:..|/* bring|
|00004860| 20 75 70 20 61 6c 65 72 | 74 20 66 6f 72 20 41 62 | up aler|t for Ab|
|00004870| 6f 75 74 20 2a 2f 0d 09 | 09 09 09 09 69 74 65 6d |out */..|....item|
|00004880| 48 69 74 20 3d 20 41 6c | 65 72 74 28 72 41 62 6f |Hit = Al|ert(rAbo|
|00004890| 75 74 41 6c 65 72 74 2c | 20 6e 69 6c 29 3b 0d 09 |utAlert,| nil);..|
|000048a0| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 09 64 |....brea|k;.....d|
|000048b0| 65 66 61 75 6c 74 3a 09 | 09 09 2f 2a 20 61 6c 6c |efault:.|../* all|
|000048c0| 20 6e 6f 6e 2d 41 62 6f | 75 74 20 69 74 65 6d 73 | non-Abo|ut items|
|000048d0| 20 69 6e 20 74 68 69 73 | 20 6d 65 6e 75 20 61 72 | in this| menu ar|
|000048e0| 65 20 44 41 73 20 2a 2f | 0d 09 09 09 09 09 2f 2a |e DAs */|....../*|
|000048f0| 20 74 79 70 65 20 53 74 | 72 32 35 35 20 69 73 20 | type St|r255 is |
|00004900| 61 6e 20 61 72 72 61 79 | 20 69 6e 20 4d 50 57 20 |an array| in MPW |
|00004910| 33 20 2a 2f 0d 09 09 09 | 09 09 47 65 74 49 74 65 |3 */....|..GetIte|
|00004920| 6d 28 47 65 74 4d 48 61 | 6e 64 6c 65 28 6d 41 70 |m(GetMHa|ndle(mAp|
|00004930| 70 6c 65 29 2c 20 6d 65 | 6e 75 49 74 65 6d 2c 20 |ple), me|nuItem, |
|00004940| 64 61 4e 61 6d 65 29 3b | 0d 09 09 09 09 09 64 61 |daName);|......da|
|00004950| 52 65 66 4e 75 6d 20 3d | 20 4f 70 65 6e 44 65 73 |RefNum =| OpenDes|
|00004960| 6b 41 63 63 28 64 61 4e | 61 6d 65 29 3b 0d 09 09 |kAcc(daN|ame);...|
|00004970| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 7d 0d 09 |...break|;....}..|
|00004980| 09 09 62 72 65 61 6b 3b | 0d 09 09 63 61 73 65 20 |..break;|...case |
|00004990| 6d 46 69 6c 65 3a 0d 09 | 09 09 73 77 69 74 63 68 |mFile:..|..switch|
|000049a0| 20 28 20 6d 65 6e 75 49 | 74 65 6d 20 29 20 7b 0d | ( menuI|tem ) {.|
|000049b0| 09 09 09 09 63 61 73 65 | 20 69 43 6c 6f 73 65 3a |....case| iClose:|
|000049c0| 0d 09 09 09 09 09 44 6f | 43 6c 6f 73 65 57 69 6e |......Do|CloseWin|
|000049d0| 64 6f 77 28 46 72 6f 6e | 74 57 69 6e 64 6f 77 28 |dow(Fron|tWindow(|
|000049e0| 29 29 3b 0d 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |));.....|.break;.|
|000049f0| 09 09 09 09 63 61 73 65 | 20 69 51 75 69 74 3a 0d |....case| iQuit:.|
|00004a00| 09 09 09 09 09 54 65 72 | 6d 69 6e 61 74 65 28 29 |.....Ter|minate()|
|00004a10| 3b 0d 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |;......b|reak;...|
|00004a20| 09 7d 0d 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 63 |.}....br|eak;...c|
|00004a30| 61 73 65 20 6d 45 64 69 | 74 3a 09 09 09 09 09 2f |ase mEdi|t:...../|
|00004a40| 2a 20 63 61 6c 6c 20 53 | 79 73 74 65 6d 45 64 69 |* call S|ystemEdi|
|00004a50| 74 20 66 6f 72 20 44 41 | 20 65 64 69 74 69 6e 67 |t for DA| editing|
|00004a60| 20 26 20 4d 75 6c 74 69 | 46 69 6e 64 65 72 20 2a | & Multi|Finder *|
|00004a70| 2f 0d 09 09 09 68 61 6e | 64 6c 65 64 42 79 44 41 |/....han|dledByDA|
|00004a80| 20 3d 20 53 79 73 74 65 | 6d 45 64 69 74 28 6d 65 | = Syste|mEdit(me|
|00004a90| 6e 75 49 74 65 6d 2d 31 | 29 3b 09 2f 2a 20 73 69 |nuItem-1|);./* si|
|00004aa0| 6e 63 65 20 77 65 20 64 | 6f 6e d5 74 20 64 6f 20 |nce we d|on.t do |
|00004ab0| 61 6e 79 20 45 64 69 74 | 69 6e 67 20 2a 2f 0d 09 |any Edit|ing */..|
|00004ac0| 09 09 62 72 65 61 6b 3b | 0d 09 09 63 61 73 65 20 |..break;|...case |
|00004ad0| 6d 4c 69 67 68 74 3a 0d | 09 09 09 73 77 69 74 63 |mLight:.|...switc|
|00004ae0| 68 20 28 20 6d 65 6e 75 | 49 74 65 6d 20 29 20 7b |h ( menu|Item ) {|
|00004af0| 0d 09 09 09 09 63 61 73 | 65 20 69 53 74 6f 70 3a |.....cas|e iStop:|
|00004b00| 0d 09 09 09 09 09 53 65 | 74 4c 69 67 68 74 28 46 |......Se|tLight(F|
|00004b10| 72 6f 6e 74 57 69 6e 64 | 6f 77 28 29 2c 20 74 72 |rontWind|ow(), tr|
|00004b20| 75 65 29 3b 0d 09 09 09 | 09 09 62 72 65 61 6b 3b |ue);....|..break;|
|00004b30| 0d 09 09 09 09 63 61 73 | 65 20 69 47 6f 3a 0d 09 |.....cas|e iGo:..|
|00004b40| 09 09 09 09 53 65 74 4c | 69 67 68 74 28 46 72 6f |....SetL|ight(Fro|
|00004b50| 6e 74 57 69 6e 64 6f 77 | 28 29 2c 20 66 61 6c 73 |ntWindow|(), fals|
|00004b60| 65 29 3b 0d 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |e);.....|.break;.|
|00004b70| 09 09 09 09 0d 09 09 09 | 09 63 61 73 65 20 69 46 |........|.case iF|
|00004b80| 69 6c 6c 3a 0d 09 09 09 | 09 09 46 69 6c 6c 54 65 |ill:....|..FillTe|
|00004b90| 72 6d 57 69 6e 64 6f 77 | 28 67 54 65 72 6d 57 69 |rmWindow|(gTermWi|
|00004ba0| 6e 64 6f 77 50 74 72 29 | 3b 0d 09 09 09 09 09 62 |ndowPtr)|;......b|
|00004bb0| 72 65 61 6b 3b 0d 09 09 | 09 7d 0d 09 09 09 62 72 |reak;...|.}....br|
|00004bc0| 65 61 6b 3b 0d 09 7d 0d | 09 48 69 6c 69 74 65 4d |eak;..}.|.HiliteM|
|00004bd0| 65 6e 75 28 30 29 3b 09 | 09 09 09 09 2f 2a 20 75 |enu(0);.|..../* u|
|00004be0| 6e 68 69 67 68 6c 69 67 | 68 74 20 77 68 61 74 20 |nhighlig|ht what |
|00004bf0| 4d 65 6e 75 53 65 6c 65 | 63 74 20 28 6f 72 20 4d |MenuSele|ct (or M|
|00004c00| 65 6e 75 4b 65 79 29 20 | 68 69 6c 69 74 65 64 20 |enuKey) |hilited |
|00004c10| 2a 2f 0d 7d 20 2f 2a 44 | 6f 4d 65 6e 75 43 6f 6d |*/.} /*D|oMenuCom|
|00004c20| 6d 61 6e 64 2a 2f 0d 0d | 0d 2f 2a 20 43 68 61 6e |mand*/..|./* Chan|
|00004c30| 67 65 20 74 68 65 20 73 | 65 74 74 69 6e 67 20 6f |ge the s|etting o|
|00004c40| 66 20 74 68 65 20 6c 69 | 67 68 74 2e 20 2a 2f 0d |f the li|ght. */.|
|00004c50| 0d 23 70 72 61 67 6d 61 | 20 73 65 67 6d 65 6e 74 |.#pragma| segment|
|00004c60| 20 4d 61 69 6e 0d 76 6f | 69 64 20 53 65 74 4c 69 | Main.vo|id SetLi|
|00004c70| 67 68 74 28 20 57 69 6e | 64 6f 77 50 74 72 20 77 |ght( Win|dowPtr w|
|00004c80| 69 6e 64 6f 77 2c 20 42 | 6f 6f 6c 65 61 6e 20 6e |indow, B|oolean n|
|00004c90| 65 77 53 74 6f 70 70 65 | 64 20 29 0d 7b 0d 09 69 |ewStoppe|d ).{..i|
|00004ca0| 66 20 28 20 6e 65 77 53 | 74 6f 70 70 65 64 20 21 |f ( newS|topped !|
|00004cb0| 3d 20 67 53 74 6f 70 70 | 65 64 20 29 20 7b 0d 09 |= gStopp|ed ) {..|
|00004cc0| 09 67 53 74 6f 70 70 65 | 64 20 3d 20 6e 65 77 53 |.gStoppe|d = newS|
|00004cd0| 74 6f 70 70 65 64 3b 0d | 09 09 53 65 74 50 6f 72 |topped;.|..SetPor|
|00004ce0| 74 28 77 69 6e 64 6f 77 | 29 3b 0d 09 09 49 6e 76 |t(window|);...Inv|
|00004cf0| 61 6c 52 65 63 74 28 26 | 77 69 6e 64 6f 77 2d 3e |alRect(&|window->|
|00004d00| 70 6f 72 74 52 65 63 74 | 29 3b 0d 09 7d 0d 0d 2f |portRect|);..}../|
|00004d10| 2f 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |/*******|********|
|00004d20| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004d30| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004d40| 2a 2a 2a 2a 2a 2a 0d 2f | 2f 09 43 6f 64 65 20 61 |******./|/.Code a|
|00004d50| 64 64 65 64 20 66 6f 72 | 20 54 65 72 6d 57 69 6e |dded for| TermWin|
|00004d60| 64 6f 77 0d 2f 2f 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |dow.//**|********|
|00004d70| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004d80| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004d90| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 0d 09 7b 0d 09 |********|***..{..|
|00004da0| 09 63 68 61 72 09 73 74 | 72 5b 32 35 35 5d 3b 0d |.char.st|r[255];.|
|00004db0| 09 09 6c 6f 6e 67 20 09 | 64 61 74 61 4c 65 6e 3b |..long .|dataLen;|
|00004dc0| 0d 0d 09 09 69 66 28 67 | 53 74 6f 70 70 65 64 29 |....if(g|Stopped)|
|00004dd0| 0d 09 09 09 73 70 72 69 | 6e 74 66 28 73 74 72 2c |....spri|ntf(str,|
|00004de0| 20 22 52 65 64 20 4c 69 | 67 68 74 2e 5c 6e 5c 72 | "Red Li|ght.\n\r|
|00004df0| 22 29 3b 0d 09 09 65 6c | 73 65 0d 09 09 09 73 70 |");...el|se....sp|
|00004e00| 72 69 6e 74 66 28 73 74 | 72 2c 20 22 47 72 65 65 |rintf(st|r, "Gree|
|00004e10| 6e 20 4c 69 67 68 74 2e | 5c 6e 5c 72 22 29 3b 0d |n Light.|\n\r");.|
|00004e20| 09 09 09 0d 09 09 64 61 | 74 61 4c 65 6e 20 3d 20 |......da|taLen = |
|00004e30| 73 74 72 6c 65 6e 28 73 | 74 72 29 3b 0d 09 09 57 |strlen(s|tr);...W|
|00004e40| 72 69 74 65 54 6f 54 65 | 72 6d 57 69 6e 64 6f 77 |riteToTe|rmWindow|
|00004e50| 28 67 54 65 72 6d 57 69 | 6e 64 6f 77 50 74 72 2c |(gTermWi|ndowPtr,|
|00004e60| 20 73 74 72 2c 20 26 64 | 61 74 61 4c 65 6e 29 3b | str, &d|ataLen);|
|00004e70| 0d 09 7d 0d 7d 20 2f 2a | 53 65 74 4c 69 67 68 74 |..}.} /*|SetLight|
|00004e80| 2a 2f 0d 0d 0d 2f 2a 20 | 43 6c 6f 73 65 20 61 20 |*/.../* |Close a |
|00004e90| 77 69 6e 64 6f 77 2e 20 | 54 68 69 73 20 68 61 6e |window. |This han|
|00004ea0| 64 6c 65 73 20 64 65 73 | 6b 20 61 63 63 65 73 73 |dles des|k access|
|00004eb0| 6f 72 79 20 61 6e 64 20 | 61 70 70 6c 69 63 61 74 |ory and |applicat|
|00004ec0| 69 6f 6e 20 77 69 6e 64 | 6f 77 73 2e 20 2a 2f 0d |ion wind|ows. */.|
|00004ed0| 0d 2f 2a 09 31 2e 30 31 | 20 2d 20 41 74 20 74 68 |./*.1.01| - At th|
|00004ee0| 69 73 20 70 6f 69 6e 74 | 2c 20 69 66 20 74 68 65 |is point|, if the|
|00004ef0| 72 65 20 77 61 73 20 61 | 20 64 6f 63 75 6d 65 6e |re was a| documen|
|00004f00| 74 20 61 73 73 6f 63 69 | 61 74 65 64 20 77 69 74 |t associ|ated wit|
|00004f10| 68 20 61 0d 09 77 69 6e | 64 6f 77 2c 20 79 6f 75 |h a..win|dow, you|
|00004f20| 20 63 6f 75 6c 64 20 64 | 6f 20 61 6e 79 20 64 6f | could d|o any do|
|00004f30| 63 75 6d 65 6e 74 20 73 | 61 76 69 6e 67 20 70 72 |cument s|aving pr|
|00004f40| 6f 63 65 73 73 69 6e 67 | 20 69 66 20 69 74 20 69 |ocessing| if it i|
|00004f50| 73 20 27 64 69 72 74 79 | 27 2e 0d 09 44 6f 43 6c |s 'dirty|'...DoCl|
|00004f60| 6f 73 65 57 69 6e 64 6f | 77 20 77 6f 75 6c 64 20 |oseWindo|w would |
|00004f70| 72 65 74 75 72 6e 20 74 | 72 75 65 20 69 66 20 74 |return t|rue if t|
|00004f80| 68 65 20 77 69 6e 64 6f | 77 20 61 63 74 75 61 6c |he windo|w actual|
|00004f90| 6c 79 20 63 6c 6f 73 65 | 64 2c 20 69 2e 65 2e 2c |ly close|d, i.e.,|
|00004fa0| 0d 09 74 68 65 20 75 73 | 65 72 20 64 69 64 6e d5 |..the us|er didn.|
|00004fb0| 74 20 63 61 6e 63 65 6c | 20 66 72 6f 6d 20 61 20 |t cancel| from a |
|00004fc0| 73 61 76 65 20 64 69 61 | 6c 6f 67 2e 20 54 68 69 |save dia|log. Thi|
|00004fd0| 73 20 72 65 73 75 6c 74 | 20 69 73 20 68 61 6e 64 |s result| is hand|
|00004fe0| 79 20 77 68 65 6e 0d 09 | 74 68 65 20 75 73 65 72 |y when..|the user|
|00004ff0| 20 71 75 69 74 73 20 61 | 6e 20 61 70 70 6c 69 63 | quits a|n applic|
|00005000| 61 74 69 6f 6e 2c 20 62 | 75 74 20 74 68 65 6e 20 |ation, b|ut then |
|00005010| 63 61 6e 63 65 6c 73 20 | 74 68 65 20 73 61 76 65 |cancels |the save|
|00005020| 20 6f 66 20 61 20 64 6f | 63 75 6d 65 6e 74 0d 09 | of a do|cument..|
|00005030| 61 73 73 6f 63 69 61 74 | 65 64 20 77 69 74 68 20 |associat|ed with |
|00005040| 61 20 77 69 6e 64 6f 77 | 2e 20 2a 2f 0d 0d 23 70 |a window|. */..#p|
|00005050| 72 61 67 6d 61 20 73 65 | 67 6d 65 6e 74 20 4d 61 |ragma se|gment Ma|
|00005060| 69 6e 0d 42 6f 6f 6c 65 | 61 6e 20 44 6f 43 6c 6f |in.Boole|an DoClo|
|00005070| 73 65 57 69 6e 64 6f 77 | 28 57 69 6e 64 6f 77 50 |seWindow|(WindowP|
|00005080| 74 72 20 77 69 6e 64 6f | 77 29 0d 7b 0d 09 69 66 |tr windo|w).{..if|
|00005090| 20 28 20 49 73 44 41 57 | 69 6e 64 6f 77 28 77 69 | ( IsDAW|indow(wi|
|000050a0| 6e 64 6f 77 29 20 29 0d | 09 09 43 6c 6f 73 65 44 |ndow) ).|..CloseD|
|000050b0| 65 73 6b 41 63 63 28 28 | 28 57 69 6e 64 6f 77 50 |eskAcc((|(WindowP|
|000050c0| 65 65 6b 29 20 77 69 6e | 64 6f 77 29 2d 3e 77 69 |eek) win|dow)->wi|
|000050d0| 6e 64 6f 77 4b 69 6e 64 | 29 3b 0d 09 65 6c 73 65 |ndowKind|);..else|
|000050e0| 20 69 66 20 28 20 49 73 | 41 70 70 57 69 6e 64 6f | if ( Is|AppWindo|
|000050f0| 77 28 77 69 6e 64 6f 77 | 29 20 29 0d 09 09 43 6c |w(window|) )...Cl|
|00005100| 6f 73 65 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |oseWindo|w(window|
|00005110| 29 3b 0d 09 72 65 74 75 | 72 6e 20 74 72 75 65 3b |);..retu|rn true;|
|00005120| 0d 7d 20 2f 2a 44 6f 43 | 6c 6f 73 65 57 69 6e 64 |.} /*DoC|loseWind|
|00005130| 6f 77 2a 2f 0d 0d 0d 2f | 2a 2a 2a 2a 2a 2a 2a 2a |ow*/.../|********|
|00005140| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005150| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005160| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005170| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005180| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 0d 2a |********|******.*|
|00005190| 2a 2a 20 31 2e 30 31 20 | 44 6f 43 6c 6f 73 65 42 |** 1.01 |DoCloseB|
|000051a0| 65 68 69 6e 64 28 77 69 | 6e 64 6f 77 29 20 77 61 |ehind(wi|ndow) wa|
|000051b0| 73 20 72 65 6d 6f 76 65 | 64 20 2a 2a 2a 0d 0d 09 |s remove|d ***...|
|000051c0| 31 2e 30 31 20 2d 20 44 | 6f 43 6c 6f 73 65 42 65 |1.01 - D|oCloseBe|
|000051d0| 68 69 6e 64 20 77 61 73 | 20 61 20 67 6f 6f 64 20 |hind was| a good |
|000051e0| 69 64 65 61 20 66 6f 72 | 20 63 6c 6f 73 69 6e 67 |idea for| closing|
|000051f0| 20 77 69 6e 64 6f 77 73 | 20 77 68 65 6e 20 71 75 | windows| when qu|
|00005200| 69 74 74 69 6e 67 0d 09 | 61 6e 64 20 6e 6f 74 20 |itting..|and not |
|00005210| 68 61 76 69 6e 67 20 74 | 6f 20 77 6f 72 72 79 20 |having t|o worry |
|00005220| 61 62 6f 75 74 20 75 70 | 64 61 74 69 6e 67 20 74 |about up|dating t|
|00005230| 68 65 20 77 69 6e 64 6f | 77 73 2c 20 62 75 74 20 |he windo|ws, but |
|00005240| 69 74 20 73 75 66 66 65 | 72 65 64 0d 09 66 72 6f |it suffe|red..fro|
|00005250| 6d 20 61 20 66 61 74 61 | 6c 20 66 6c 61 77 2e 20 |m a fata|l flaw. |
|00005260| 49 66 20 61 20 64 65 73 | 6b 20 61 63 63 65 73 73 |If a des|k access|
|00005270| 6f 72 79 20 6f 77 6e 65 | 64 20 74 77 6f 20 77 69 |ory owne|d two wi|
|00005280| 6e 64 6f 77 73 2c 20 69 | 74 20 77 6f 75 6c 64 0d |ndows, i|t would.|
|00005290| 09 63 6c 6f 73 65 20 62 | 6f 74 68 20 74 68 6f 73 |.close b|oth thos|
|000052a0| 65 20 77 69 6e 64 6f 77 | 73 20 77 68 65 6e 20 43 |e window|s when C|
|000052b0| 6c 6f 73 65 44 65 73 6b | 41 63 63 20 77 61 73 20 |loseDesk|Acc was |
|000052c0| 63 61 6c 6c 65 64 2e 20 | 57 68 65 6e 20 44 6f 43 |called. |When DoC|
|000052d0| 6c 6f 73 65 42 65 68 69 | 6e 64 0d 09 67 6f 74 20 |loseBehi|nd..got |
|000052e0| 61 72 6f 75 6e 64 20 74 | 6f 20 63 61 6c 6c 69 6e |around t|o callin|
|000052f0| 67 20 44 6f 43 6c 6f 73 | 65 57 69 6e 64 6f 77 20 |g DoClos|eWindow |
|00005300| 66 6f 72 20 74 68 61 74 | 20 6f 74 68 65 72 20 77 |for that| other w|
|00005310| 69 6e 64 6f 77 20 74 68 | 61 74 20 77 61 73 20 61 |indow th|at was a|
|00005320| 6c 72 65 61 64 79 0d 09 | 63 6c 6f 73 65 64 2c 20 |lready..|closed, |
|00005330| 74 68 69 6e 67 73 20 77 | 6f 75 6c 64 20 67 6f 20 |things w|ould go |
|00005340| 76 65 72 79 20 70 6f 6f | 72 6c 79 2e 20 41 6e 6f |very poo|rly. Ano|
|00005350| 74 68 65 72 20 6f 70 74 | 69 6f 6e 20 77 6f 75 6c |ther opt|ion woul|
|00005360| 64 20 62 65 20 74 6f 20 | 68 61 76 65 20 61 0d 09 |d be to |have a..|
|00005370| 70 72 6f 63 65 64 75 72 | 65 2c 20 47 65 74 52 65 |procedur|e, GetRe|
|00005380| 61 72 57 69 6e 64 6f 77 | 2c 20 74 68 61 74 20 77 |arWindow|, that w|
|00005390| 6f 75 6c 64 20 67 6f 20 | 74 68 72 6f 75 67 68 20 |ould go |through |
|000053a0| 74 68 65 20 77 69 6e 64 | 6f 77 20 6c 69 73 74 20 |the wind|ow list |
|000053b0| 61 6e 64 20 72 65 74 75 | 72 6e 0d 09 74 68 65 20 |and retu|rn..the |
|000053c0| 6c 61 73 74 20 77 69 6e | 64 6f 77 2e 20 49 6e 73 |last win|dow. Ins|
|000053d0| 74 65 61 64 2c 20 77 65 | 20 64 65 63 69 64 65 64 |tead, we| decided|
|000053e0| 20 74 6f 20 70 72 65 73 | 65 6e 74 20 74 68 65 20 | to pres|ent the |
|000053f0| 73 74 61 6e 64 61 72 64 | 20 61 70 70 72 6f 61 63 |standard| approac|
|00005400| 68 0d 09 6f 66 20 67 65 | 74 74 69 6e 67 20 61 6e |h..of ge|tting an|
|00005410| 64 20 63 6c 6f 73 69 6e | 67 20 46 72 6f 6e 74 57 |d closin|g FrontW|
|00005420| 69 6e 64 6f 77 20 75 6e | 74 69 6c 20 46 72 6f 6e |indow un|til Fron|
|00005430| 74 57 69 6e 64 6f 77 20 | 72 65 74 75 72 6e 73 20 |tWindow |returns |
|00005440| 4e 49 4c 2e 20 54 68 69 | 73 0d 09 68 61 73 20 61 |NIL. Thi|s..has a|
|00005450| 20 70 6f 74 65 6e 74 69 | 61 6c 20 62 65 6e 65 66 | potenti|al benef|
|00005460| 69 74 20 69 6e 20 74 68 | 61 74 20 74 68 65 20 77 |it in th|at the w|
|00005470| 69 6e 64 6f 77 20 77 68 | 6f 73 65 20 64 6f 63 75 |indow wh|ose docu|
|00005480| 6d 65 6e 74 20 6e 65 65 | 64 73 20 74 6f 20 62 65 |ment nee|ds to be|
|00005490| 20 73 61 76 65 64 0d 09 | 6d 61 79 20 62 65 20 76 | saved..|may be v|
|000054a0| 69 73 69 62 6c 65 20 73 | 69 6e 63 65 20 69 74 20 |isible s|ince it |
|000054b0| 69 73 20 74 68 65 20 66 | 72 6f 6e 74 20 77 69 6e |is the f|ront win|
|000054c0| 64 6f 77 2c 20 74 68 65 | 72 65 66 6f 72 65 20 64 |dow, the|refore d|
|000054d0| 65 63 72 65 61 73 69 6e | 67 20 74 68 65 0d 09 63 |ecreasin|g the..c|
|000054e0| 68 61 6e 63 65 20 6f 66 | 20 75 73 65 72 20 63 6f |hance of| user co|
|000054f0| 6e 66 75 73 69 6f 6e 2e | 20 46 6f 72 20 61 65 73 |nfusion.| For aes|
|00005500| 74 68 65 74 69 63 20 72 | 65 61 73 6f 6e 73 2c 20 |thetic r|easons, |
|00005510| 74 68 65 20 77 69 6e 64 | 6f 77 73 20 69 6e 20 74 |the wind|ows in t|
|00005520| 68 65 0d 09 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |he..appl|ication |
|00005530| 73 68 6f 75 6c 64 20 62 | 65 20 63 68 65 63 6b 65 |should b|e checke|
|00005540| 64 20 66 6f 72 20 75 70 | 64 61 74 65 73 20 70 65 |d for up|dates pe|
|00005550| 72 69 6f 64 69 63 61 6c | 6c 79 20 61 6e 64 20 68 |riodical|ly and h|
|00005560| 61 76 65 20 74 68 65 0d | 09 75 70 64 61 74 65 73 |ave the.|.updates|
|00005570| 20 73 65 72 76 69 63 65 | 64 2e 0d 2a 2a 2a 2a 2a | service|d..*****|
|00005580| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005590| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000055a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000055b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000055c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000055d0| 2a 2f 0d 0d 0d 2f 2a 20 | 43 6c 65 61 6e 20 75 70 |*/.../* |Clean up|
|000055e0| 20 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | the app|lication|
|000055f0| 20 61 6e 64 20 65 78 69 | 74 2e 20 57 65 20 63 6c | and exi|t. We cl|
|00005600| 6f 73 65 20 61 6c 6c 20 | 6f 66 20 74 68 65 20 77 |ose all |of the w|
|00005610| 69 6e 64 6f 77 73 20 73 | 6f 20 74 68 61 74 0d 20 |indows s|o that. |
|00005620| 74 68 65 79 20 63 61 6e | 20 75 70 64 61 74 65 20 |they can| update |
|00005630| 74 68 65 69 72 20 64 6f | 63 75 6d 65 6e 74 73 2c |their do|cuments,|
|00005640| 20 69 66 20 61 6e 79 2e | 20 2a 2f 0d 20 0d 2f 2a | if any.| */. ./*|
|00005650| 09 31 2e 30 31 20 2d 20 | 49 66 20 77 65 20 66 69 |.1.01 - |If we fi|
|00005660| 6e 64 20 6f 75 74 20 74 | 68 61 74 20 61 20 63 61 |nd out t|hat a ca|
|00005670| 6e 63 65 6c 20 68 61 73 | 20 6f 63 63 75 72 72 65 |ncel has| occurre|
|00005680| 64 2c 20 77 65 20 77 6f | 6e 27 74 20 65 78 69 74 |d, we wo|n't exit|
|00005690| 20 74 6f 20 74 68 65 0d | 09 73 68 65 6c 6c 2c 20 | to the.|.shell, |
|000056a0| 62 75 74 20 77 69 6c 6c | 20 72 65 74 75 72 6e 20 |but will| return |
|000056b0| 69 6e 73 74 65 61 64 2e | 20 2a 2f 0d 0d 23 70 72 |instead.| */..#pr|
|000056c0| 61 67 6d 61 20 73 65 67 | 6d 65 6e 74 20 4d 61 69 |agma seg|ment Mai|
|000056d0| 6e 0d 76 6f 69 64 20 54 | 65 72 6d 69 6e 61 74 65 |n.void T|erminate|
|000056e0| 28 29 0d 7b 0d 09 57 69 | 6e 64 6f 77 50 74 72 09 |().{..Wi|ndowPtr.|
|000056f0| 61 57 69 6e 64 6f 77 3b | 0d 09 42 6f 6f 6c 65 61 |aWindow;|..Boolea|
|00005700| 6e 09 09 63 6c 6f 73 65 | 64 3b 0d 09 0d 09 09 2f |n..close|d;...../|
|00005710| 2f 61 64 64 65 64 20 74 | 6f 20 6b 65 65 70 20 54 |/added t|o keep T|
|00005720| 65 72 6d 57 69 6e 64 6f | 77 20 68 61 6e 64 6c 69 |ermWindo|w handli|
|00005730| 6e 67 20 73 69 6d 70 6c | 65 0d 09 45 78 69 74 54 |ng simpl|e..ExitT|
|00005740| 6f 53 68 65 6c 6c 28 29 | 3b 0d 09 0d 09 63 6c 6f |oShell()|;....clo|
|00005750| 73 65 64 20 3d 20 74 72 | 75 65 3b 0d 09 64 6f 20 |sed = tr|ue;..do |
|00005760| 7b 0d 09 09 61 57 69 6e | 64 6f 77 20 3d 20 46 72 |{...aWin|dow = Fr|
|00005770| 6f 6e 74 57 69 6e 64 6f | 77 28 29 3b 09 09 09 09 |ontWindo|w();....|
|00005780| 2f 2a 20 67 65 74 20 74 | 68 65 20 63 75 72 72 65 |/* get t|he curre|
|00005790| 6e 74 20 66 72 6f 6e 74 | 20 77 69 6e 64 6f 77 20 |nt front| window |
|000057a0| 2a 2f 0d 09 09 69 66 20 | 28 61 57 69 6e 64 6f 77 |*/...if |(aWindow|
|000057b0| 20 21 3d 20 6e 69 6c 29 | 0d 09 09 09 63 6c 6f 73 | != nil)|....clos|
|000057c0| 65 64 20 3d 20 44 6f 43 | 6c 6f 73 65 57 69 6e 64 |ed = DoC|loseWind|
|000057d0| 6f 77 28 61 57 69 6e 64 | 6f 77 29 3b 09 2f 2a 20 |ow(aWind|ow);./* |
|000057e0| 63 6c 6f 73 65 20 74 68 | 69 73 20 77 69 6e 64 6f |close th|is windo|
|000057f0| 77 20 2a 2f 09 0d 09 7d | 0d 09 77 68 69 6c 65 20 |w */...}|..while |
|00005800| 28 63 6c 6f 73 65 64 20 | 26 26 20 28 61 57 69 6e |(closed |&& (aWin|
|00005810| 64 6f 77 20 21 3d 20 6e | 69 6c 29 29 3b 0d 09 69 |dow != n|il));..i|
|00005820| 66 20 28 63 6c 6f 73 65 | 64 29 0d 09 09 45 78 69 |f (close|d)...Exi|
|00005830| 74 54 6f 53 68 65 6c 6c | 28 29 3b 09 09 09 09 09 |tToShell|();.....|
|00005840| 09 09 2f 2a 20 65 78 69 | 74 20 69 66 20 6e 6f 20 |../* exi|t if no |
|00005850| 63 61 6e 63 65 6c 6c 61 | 74 69 6f 6e 20 2a 2f 0d |cancella|tion */.|
|00005860| 7d 20 2f 2a 54 65 72 6d | 69 6e 61 74 65 2a 2f 0d |} /*Term|inate*/.|
|00005870| 0d 0d 2f 2a 09 53 65 74 | 20 75 70 20 74 68 65 20 |../*.Set| up the |
|00005880| 77 68 6f 6c 65 20 77 6f | 72 6c 64 2c 20 69 6e 63 |whole wo|rld, inc|
|00005890| 6c 75 64 69 6e 67 20 67 | 6c 6f 62 61 6c 20 76 61 |luding g|lobal va|
|000058a0| 72 69 61 62 6c 65 73 2c | 20 54 6f 6f 6c 62 6f 78 |riables,| Toolbox|
|000058b0| 20 6d 61 6e 61 67 65 72 | 73 2c 0d 09 61 6e 64 20 | manager|s,..and |
|000058c0| 6d 65 6e 75 73 2e 20 57 | 65 20 61 6c 73 6f 20 63 |menus. W|e also c|
|000058d0| 72 65 61 74 65 20 6f 75 | 72 20 6f 6e 65 20 61 70 |reate ou|r one ap|
|000058e0| 70 6c 69 63 61 74 69 6f | 6e 20 77 69 6e 64 6f 77 |plicatio|n window|
|000058f0| 20 61 74 20 74 68 69 73 | 20 74 69 6d 65 2e 0d 09 | at this| time...|
|00005900| 53 69 6e 63 65 20 77 69 | 6e 64 6f 77 20 73 74 6f |Since wi|ndow sto|
|00005910| 72 61 67 65 20 69 73 20 | 6e 6f 6e 2d 72 65 6c 6f |rage is |non-relo|
|00005920| 63 61 74 65 61 62 6c 65 | 2c 20 68 6f 77 20 61 6e |cateable|, how an|
|00005930| 64 20 77 68 65 6e 20 74 | 6f 20 61 6c 6c 6f 63 61 |d when t|o alloca|
|00005940| 74 65 20 73 70 61 63 65 | 0d 09 66 6f 72 20 77 69 |te space|..for wi|
|00005950| 6e 64 6f 77 73 20 69 73 | 20 76 65 72 79 20 69 6d |ndows is| very im|
|00005960| 70 6f 72 74 61 6e 74 20 | 73 6f 20 74 68 61 74 20 |portant |so that |
|00005970| 68 65 61 70 20 66 72 61 | 67 6d 65 6e 74 61 74 69 |heap fra|gmentati|
|00005980| 6f 6e 20 64 6f 65 73 20 | 6e 6f 74 20 6f 63 63 75 |on does |not occu|
|00005990| 72 2e 0d 09 42 65 63 61 | 75 73 65 20 53 61 6d 70 |r...Beca|use Samp|
|000059a0| 6c 65 20 68 61 73 20 6f | 6e 6c 79 20 6f 6e 65 20 |le has o|nly one |
|000059b0| 77 69 6e 64 6f 77 20 61 | 6e 64 20 69 74 20 69 73 |window a|nd it is|
|000059c0| 20 6f 6e 6c 79 20 64 69 | 73 70 6f 73 65 64 20 77 | only di|sposed w|
|000059d0| 68 65 6e 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 |hen the |applicat|
|000059e0| 69 6f 6e 0d 09 71 75 69 | 74 73 2c 20 77 65 20 77 |ion..qui|ts, we w|
|000059f0| 69 6c 6c 20 61 6c 6c 6f | 63 61 74 65 20 69 74 73 |ill allo|cate its|
|00005a00| 20 73 70 61 63 65 20 68 | 65 72 65 2c 20 62 65 66 | space h|ere, bef|
|00005a10| 6f 72 65 20 61 6e 79 74 | 68 69 6e 67 20 74 68 61 |ore anyt|hing tha|
|00005a20| 74 20 6d 69 67 68 74 20 | 62 65 20 61 20 6c 6f 63 |t might |be a loc|
|00005a30| 6b 65 64 0d 09 72 65 6c | 6f 63 61 74 61 62 6c 65 |ked..rel|ocatable|
|00005a40| 20 6f 62 6a 65 63 74 20 | 67 65 74 73 20 69 6e 74 | object |gets int|
|00005a50| 6f 20 74 68 65 20 68 65 | 61 70 2e 20 54 68 69 73 |o the he|ap. This|
|00005a60| 20 77 61 79 2c 20 77 65 | 20 63 61 6e 20 66 6f 72 | way, we| can for|
|00005a70| 63 65 20 74 68 65 20 73 | 74 6f 72 61 67 65 20 74 |ce the s|torage t|
|00005a80| 6f 20 62 65 0d 09 69 6e | 20 74 68 65 20 6c 6f 77 |o be..in| the low|
|00005a90| 65 73 74 20 6d 65 6d 6f | 72 79 20 61 76 61 69 6c |est memo|ry avail|
|00005aa0| 61 62 6c 65 20 69 6e 20 | 74 68 65 20 68 65 61 70 |able in |the heap|
|00005ab0| 2e 20 57 69 6e 64 6f 77 | 20 73 74 6f 72 61 67 65 |. Window| storage|
|00005ac0| 20 63 61 6e 20 64 69 66 | 66 65 72 20 77 69 64 65 | can dif|fer wide|
|00005ad0| 6c 79 0d 09 61 6d 6f 6e | 67 73 74 20 61 70 70 6c |ly..amon|gst appl|
|00005ae0| 69 63 61 74 69 6f 6e 73 | 20 64 65 70 65 6e 64 69 |ications| dependi|
|00005af0| 6e 67 20 6f 6e 20 68 6f | 77 20 6d 61 6e 79 20 77 |ng on ho|w many w|
|00005b00| 69 6e 64 6f 77 73 20 61 | 72 65 20 63 72 65 61 74 |indows a|re creat|
|00005b10| 65 64 20 61 6e 64 20 64 | 69 73 70 6f 73 65 64 2e |ed and d|isposed.|
|00005b20| 20 2a 2f 0d 0d 2f 2a 09 | 31 2e 30 31 20 2d 20 54 | */../*.|1.01 - T|
|00005b30| 68 65 20 63 6f 64 65 20 | 74 68 61 74 20 75 73 65 |he code |that use|
|00005b40| 64 20 74 6f 20 62 65 20 | 70 61 72 74 20 6f 66 20 |d to be |part of |
|00005b50| 46 6f 72 63 65 45 6e 76 | 69 72 6f 6e 73 20 68 61 |ForceEnv|irons ha|
|00005b60| 73 20 62 65 65 6e 20 6d | 6f 76 65 64 20 69 6e 74 |s been m|oved int|
|00005b70| 6f 0d 09 74 68 69 73 20 | 6d 6f 64 75 6c 65 2e 20 |o..this |module. |
|00005b80| 49 66 20 61 6e 20 65 72 | 72 6f 72 20 69 73 20 64 |If an er|ror is d|
|00005b90| 65 74 65 63 74 65 64 2c | 20 69 6e 73 74 65 61 64 |etected,| instead|
|00005ba0| 20 6f 66 20 6d 65 72 65 | 6c 79 20 64 6f 69 6e 67 | of mere|ly doing|
|00005bb0| 20 61 6e 20 45 78 69 74 | 54 6f 53 68 65 6c 6c 2c | an Exit|ToShell,|
|00005bc0| 0d 09 77 68 69 63 68 20 | 6c 65 61 76 65 73 20 74 |..which |leaves t|
|00005bd0| 68 65 20 75 73 65 72 20 | 77 69 74 68 6f 75 74 20 |he user |without |
|00005be0| 6d 75 63 68 20 74 6f 20 | 67 6f 20 6f 6e 2c 20 77 |much to |go on, w|
|00005bf0| 65 20 63 61 6c 6c 20 41 | 6c 65 72 74 55 73 65 72 |e call A|lertUser|
|00005c00| 2c 20 77 68 69 63 68 20 | 70 75 74 73 0d 09 75 70 |, which |puts..up|
|00005c10| 20 61 20 73 69 6d 70 6c | 65 20 61 6c 65 72 74 20 | a simpl|e alert |
|00005c20| 74 68 61 74 20 6a 75 73 | 74 20 73 61 79 73 20 61 |that jus|t says a|
|00005c30| 6e 20 65 72 72 6f 72 20 | 6f 63 63 75 72 72 65 64 |n error |occurred|
|00005c40| 20 61 6e 64 20 74 68 65 | 6e 20 63 61 6c 6c 73 20 | and the|n calls |
|00005c50| 45 78 69 74 54 6f 53 68 | 65 6c 6c 2e 0d 09 53 69 |ExitToSh|ell...Si|
|00005c60| 6e 63 65 20 74 68 65 72 | 65 20 69 73 20 6e 6f 20 |nce ther|e is no |
|00005c70| 6f 74 68 65 72 20 63 6c | 65 61 6e 75 70 20 6e 65 |other cl|eanup ne|
|00005c80| 65 64 65 64 20 61 74 20 | 74 68 69 73 20 70 6f 69 |eded at |this poi|
|00005c90| 6e 74 20 69 66 20 61 6e | 20 65 72 72 6f 72 20 69 |nt if an| error i|
|00005ca0| 73 20 64 65 74 65 63 74 | 65 64 2c 0d 09 74 68 69 |s detect|ed,..thi|
|00005cb0| 73 20 66 6f 72 6d 20 6f | 66 20 65 72 72 6f 72 2d |s form o|f error-|
|00005cc0| 20 68 61 6e 64 6c 69 6e | 67 20 69 73 20 61 63 63 | handlin|g is acc|
|00005cd0| 65 70 74 61 62 6c 65 2e | 20 49 66 20 6d 6f 72 65 |eptable.| If more|
|00005ce0| 20 73 6f 70 68 69 73 74 | 69 63 61 74 65 64 20 65 | sophist|icated e|
|00005cf0| 72 72 6f 72 20 72 65 63 | 6f 76 65 72 79 0d 09 69 |rror rec|overy..i|
|00005d00| 73 20 6e 65 65 64 65 64 | 2c 20 61 6e 20 65 78 63 |s needed|, an exc|
|00005d10| 65 70 74 69 6f 6e 20 6d | 65 63 68 61 6e 69 73 6d |eption m|echanism|
|00005d20| 2c 20 73 75 63 68 20 61 | 73 20 69 73 20 70 72 6f |, such a|s is pro|
|00005d30| 76 69 64 65 64 20 62 79 | 20 53 69 67 6e 61 6c 73 |vided by| Signals|
|00005d40| 2c 20 63 61 6e 20 62 65 | 20 75 73 65 64 2e 20 2a |, can be| used. *|
|00005d50| 2f 0d 0d 23 70 72 61 67 | 6d 61 20 73 65 67 6d 65 |/..#prag|ma segme|
|00005d60| 6e 74 20 49 6e 69 74 69 | 61 6c 69 7a 65 0d 76 6f |nt Initi|alize.vo|
|00005d70| 69 64 20 49 6e 69 74 69 | 61 6c 69 7a 65 28 29 0d |id Initi|alize().|
|00005d80| 7b 0d 09 48 61 6e 64 6c | 65 09 09 6d 65 6e 75 42 |{..Handl|e..menuB|
|00005d90| 61 72 3b 0d 09 41 70 70 | 57 69 6e 64 6f 77 50 74 |ar;..App|WindowPt|
|00005da0| 72 09 61 70 70 57 69 6e | 64 6f 77 20 3d 20 6e 69 |r.appWin|dow = ni|
|00005db0| 6c 3b 0d 09 57 69 6e 64 | 6f 77 50 74 72 09 77 69 |l;..Wind|owPtr.wi|
|00005dc0| 6e 64 6f 77 3b 0d 09 6c | 6f 6e 67 09 09 74 6f 74 |ndow;..l|ong..tot|
|00005dd0| 61 6c 2c 20 63 6f 6e 74 | 69 67 3b 0d 09 45 76 65 |al, cont|ig;..Eve|
|00005de0| 6e 74 52 65 63 6f 72 64 | 20 65 76 65 6e 74 3b 0d |ntRecord| event;.|
|00005df0| 09 73 68 6f 72 74 09 09 | 63 6f 75 6e 74 3b 0d 09 |.short..|count;..|
|00005e00| 0d 09 4f 53 45 72 72 09 | 09 09 09 72 65 73 75 6c |..OSErr.|...resul|
|00005e10| 74 20 3d 20 6e 6f 45 72 | 72 3b 09 09 2f 2f 61 64 |t = noEr|r;..//ad|
|00005e20| 64 65 64 20 74 68 65 73 | 65 20 76 61 72 69 61 62 |ded thes|e variab|
|00005e30| 6c 65 73 20 62 65 63 61 | 75 73 65 20 6f 66 20 54 |les beca|use of T|
|00005e40| 65 72 6d 57 69 6e 64 6f | 77 0d 09 52 65 63 74 09 |ermWindo|w..Rect.|
|00005e50| 09 09 09 77 69 6e 64 6f | 77 52 65 63 74 20 3d 20 |...windo|wRect = |
|00005e60| 7b 20 30 2c 20 30 2c 20 | 30 2c 20 30 20 7d 3b 0d |{ 0, 0, |0, 0 };.|
|00005e70| 09 57 69 6e 64 6f 77 50 | 74 72 09 09 09 61 57 69 |.WindowP|tr...aWi|
|00005e80| 6e 64 6f 77 50 74 72 20 | 3d 20 6e 69 6c 3b 0d 09 |ndowPtr |= nil;..|
|00005e90| 0d 09 53 74 72 32 35 35 | 09 09 09 09 74 65 6d 70 |..Str255|....temp|
|00005ea0| 53 74 72 69 6e 67 3b 09 | 09 09 2f 2f 64 69 73 70 |String;.|..//disp|
|00005eb0| 6c 61 79 20 4d 65 6d 45 | 72 72 6f 72 28 29 20 69 |lay MemE|rror() i|
|00005ec0| 66 20 6e 6f 74 20 65 6e | 6f 75 67 68 20 6d 65 6d |f not en|ough mem|
|00005ed0| 6f 72 79 2e 0d 0d 0d 09 | 67 49 6e 42 61 63 6b 67 |ory.....|gInBackg|
|00005ee0| 72 6f 75 6e 64 20 3d 20 | 66 61 6c 73 65 3b 0d 0d |round = |false;..|
|00005ef0| 09 49 6e 69 74 47 72 61 | 66 28 28 50 74 72 29 20 |.InitGra|f((Ptr) |
|00005f00| 26 71 64 2e 74 68 65 50 | 6f 72 74 29 3b 0d 09 49 |&qd.theP|ort);..I|
|00005f10| 6e 69 74 46 6f 6e 74 73 | 28 29 3b 0d 09 49 6e 69 |nitFonts|();..Ini|
|00005f20| 74 57 69 6e 64 6f 77 73 | 28 29 3b 0d 09 49 6e 69 |tWindows|();..Ini|
|00005f30| 74 4d 65 6e 75 73 28 29 | 3b 0d 09 54 45 49 6e 69 |tMenus()|;..TEIni|
|00005f40| 74 28 29 3b 0d 09 49 6e | 69 74 44 69 61 6c 6f 67 |t();..In|itDialog|
|00005f50| 73 28 6e 69 6c 29 3b 0d | 09 49 6e 69 74 43 75 72 |s(nil);.|.InitCur|
|00005f60| 73 6f 72 28 29 3b 0d 09 | 0d 09 2f 2a 09 43 61 6c |sor();..|../*.Cal|
|00005f70| 6c 20 4d 50 50 4f 70 65 | 6e 20 61 6e 64 20 41 54 |l MPPOpe|n and AT|
|00005f80| 50 4c 6f 61 64 20 61 74 | 20 74 68 69 73 20 70 6f |PLoad at| this po|
|00005f90| 69 6e 74 20 74 6f 20 69 | 6e 69 74 69 61 6c 69 7a |int to i|nitializ|
|00005fa0| 65 20 41 70 70 6c 65 54 | 61 6c 6b 2c 0d 09 20 09 |e AppleT|alk,.. .|
|00005fb0| 69 66 20 79 6f 75 20 61 | 72 65 20 75 73 69 6e 67 |if you a|re using|
|00005fc0| 20 69 74 2e 20 2a 2f 0d | 09 2f 2a 09 4e 4f 54 45 | it. */.|./*.NOTE|
|00005fd0| 20 2d 2d 20 49 74 20 69 | 73 20 6e 6f 20 6c 6f 6e | -- It i|s no lon|
|00005fe0| 67 65 72 20 6e 65 63 65 | 73 73 61 72 79 2c 20 61 |ger nece|ssary, a|
|00005ff0| 6e 64 20 61 63 74 75 61 | 6c 6c 79 20 75 6e 68 65 |nd actua|lly unhe|
|00006000| 61 6c 74 68 79 2c 20 74 | 6f 20 63 68 65 63 6b 0d |althy, t|o check.|
|00006010| 09 09 50 6f 72 74 42 55 | 73 65 20 61 6e 64 20 53 |..PortBU|se and S|
|00006020| 50 43 6f 6e 66 69 67 20 | 62 65 66 6f 72 65 20 6f |PConfig |before o|
|00006030| 70 65 6e 69 6e 67 20 41 | 70 70 6c 65 54 61 6c 6b |pening A|ppleTalk|
|00006040| 2e 20 54 68 65 20 64 72 | 69 76 65 72 73 20 61 72 |. The dr|ivers ar|
|00006050| 65 20 63 61 70 61 62 6c | 65 0d 09 09 6f 66 20 63 |e capabl|e...of c|
|00006060| 68 65 63 6b 69 6e 67 20 | 66 6f 72 20 70 6f 72 74 |hecking |for port|
|00006070| 20 61 76 61 69 6c 61 62 | 69 6c 69 74 79 20 74 68 | availab|ility th|
|00006080| 65 6d 73 65 6c 76 65 73 | 2e 20 2a 2f 0d 09 0d 09 |emselves|. */....|
|00006090| 2f 2a 09 54 68 69 73 20 | 6e 65 78 74 20 62 69 74 |/*.This |next bit|
|000060a0| 20 6f 66 20 63 6f 64 65 | 20 69 73 20 6e 65 63 65 | of code| is nece|
|000060b0| 73 73 61 72 79 20 74 6f | 20 61 6c 6c 6f 77 20 74 |ssary to| allow t|
|000060c0| 68 65 20 64 65 66 61 75 | 6c 74 20 62 75 74 74 6f |he defau|lt butto|
|000060d0| 6e 20 6f 66 20 6f 75 72 | 0d 09 09 61 6c 65 72 74 |n of our|...alert|
|000060e0| 20 62 65 20 6f 75 74 6c | 69 6e 65 64 2e 0d 09 09 | be outl|ined....|
|000060f0| 31 2e 30 32 20 2d 20 43 | 68 61 6e 67 65 64 20 74 |1.02 - C|hanged t|
|00006100| 6f 20 63 61 6c 6c 20 45 | 76 65 6e 74 41 76 61 69 |o call E|ventAvai|
|00006110| 6c 20 73 6f 20 74 68 61 | 74 20 77 65 20 64 6f 6e |l so tha|t we don|
|00006120| 27 74 20 6c 6f 73 65 20 | 73 6f 6d 65 20 69 6d 70 |'t lose |some imp|
|00006130| 6f 72 74 61 6e 74 0d 09 | 09 65 76 65 6e 74 73 2e |ortant..|.events.|
|00006140| 20 2a 2f 0d 09 20 0d 09 | 66 6f 72 20 28 63 6f 75 | */.. ..|for (cou|
|00006150| 6e 74 20 3d 20 31 3b 20 | 63 6f 75 6e 74 20 3c 3d |nt = 1; |count <=|
|00006160| 20 33 3b 20 63 6f 75 6e | 74 2b 2b 29 0d 09 09 45 | 3; coun|t++)...E|
|00006170| 76 65 6e 74 41 76 61 69 | 6c 28 65 76 65 72 79 45 |ventAvai|l(everyE|
|00006180| 76 65 6e 74 2c 20 26 65 | 76 65 6e 74 29 3b 0d 09 |vent, &e|vent);..|
|00006190| 0d 09 2f 2a 09 49 67 6e | 6f 72 65 20 74 68 65 20 |../*.Ign|ore the |
|000061a0| 65 72 72 6f 72 20 72 65 | 74 75 72 6e 65 64 20 66 |error re|turned f|
|000061b0| 72 6f 6d 20 53 79 73 45 | 6e 76 69 72 6f 6e 73 3b |rom SysE|nvirons;|
|000061c0| 20 65 76 65 6e 20 69 66 | 20 61 6e 20 65 72 72 6f | even if| an erro|
|000061d0| 72 20 6f 63 63 75 72 72 | 65 64 2c 0d 09 09 74 68 |r occurr|ed,...th|
|000061e0| 65 20 53 79 73 45 6e 76 | 69 72 6f 6e 73 20 67 6c |e SysEnv|irons gl|
|000061f0| 75 65 20 77 69 6c 6c 20 | 66 69 6c 6c 20 69 6e 20 |ue will |fill in |
|00006200| 74 68 65 20 53 79 73 45 | 6e 76 52 65 63 2e 20 59 |the SysE|nvRec. Y|
|00006210| 6f 75 20 63 61 6e 20 73 | 61 76 65 20 61 20 72 65 |ou can s|ave a re|
|00006220| 64 75 6e 64 61 6e 74 0d | 09 09 63 61 6c 6c 20 74 |dundant.|..call t|
|00006230| 6f 20 53 79 73 45 6e 76 | 69 72 6f 6e 73 20 62 79 |o SysEnv|irons by|
|00006240| 20 63 61 6c 6c 69 6e 67 | 20 69 74 20 61 66 74 65 | calling| it afte|
|00006250| 72 20 69 6e 69 74 69 61 | 6c 69 7a 69 6e 67 20 41 |r initia|lizing A|
|00006260| 70 70 6c 65 54 61 6c 6b | 2e 20 2a 2f 0d 09 20 0d |ppleTalk|. */.. .|
|00006270| 09 53 79 73 45 6e 76 69 | 72 6f 6e 73 28 6b 53 79 |.SysEnvi|rons(kSy|
|00006280| 73 45 6e 76 69 72 6f 6e | 73 56 65 72 73 69 6f 6e |sEnviron|sVersion|
|00006290| 2c 20 26 67 4d 61 63 29 | 3b 0d 09 0d 09 2f 2a 20 |, &gMac)|;..../* |
|000062a0| 4d 61 6b 65 20 73 75 72 | 65 20 74 68 61 74 20 74 |Make sur|e that t|
|000062b0| 68 65 20 6d 61 63 68 69 | 6e 65 20 68 61 73 20 61 |he machi|ne has a|
|000062c0| 74 20 6c 65 61 73 74 20 | 31 32 38 4b 20 52 4f 4d |t least |128K ROM|
|000062d0| 73 2e 20 49 66 20 69 74 | 20 64 6f 65 73 6e 27 74 |s. If it| doesn't|
|000062e0| 2c 20 65 78 69 74 2e 20 | 2a 2f 0d 09 0d 09 69 66 |, exit. |*/....if|
|000062f0| 20 28 67 4d 61 63 2e 6d | 61 63 68 69 6e 65 54 79 | (gMac.m|achineTy|
|00006300| 70 65 20 3c 20 30 29 20 | 41 6c 65 72 74 55 73 65 |pe < 0) |AlertUse|
|00006310| 72 28 29 3b 0d 09 0d 09 | 2f 2a 09 31 2e 30 32 20 |r();....|/*.1.02 |
|00006320| 2d 20 4d 6f 76 65 20 54 | 72 61 70 41 76 61 69 6c |- Move T|rapAvail|
|00006330| 61 62 6c 65 20 63 61 6c | 6c 20 74 6f 20 61 66 74 |able cal|l to aft|
|00006340| 65 72 20 53 79 73 45 6e | 76 69 72 6f 6e 73 20 73 |er SysEn|virons s|
|00006350| 6f 20 74 68 61 74 20 77 | 65 20 63 61 6e 20 74 65 |o that w|e can te|
|00006360| 6c 6c 0d 09 09 69 6e 20 | 54 72 61 70 41 76 61 69 |ll...in |TrapAvai|
|00006370| 6c 61 62 6c 65 20 69 66 | 20 61 20 74 6f 6f 6c 20 |lable if| a tool |
|00006380| 74 72 61 70 20 76 61 6c | 75 65 20 69 73 20 6f 75 |trap val|ue is ou|
|00006390| 74 20 6f 66 20 72 61 6e | 67 65 2e 20 2a 2f 0d 09 |t of ran|ge. */..|
|000063a0| 09 0d 09 67 48 61 73 57 | 61 69 74 4e 65 78 74 45 |...gHasW|aitNextE|
|000063b0| 76 65 6e 74 20 3d 20 54 | 72 61 70 41 76 61 69 6c |vent = T|rapAvail|
|000063c0| 61 62 6c 65 28 5f 57 61 | 69 74 4e 65 78 74 45 76 |able(_Wa|itNextEv|
|000063d0| 65 6e 74 2c 20 54 6f 6f | 6c 54 72 61 70 29 3b 0d |ent, Too|lTrap);.|
|000063e0| 0d 09 2f 2a 09 31 2e 30 | 31 20 2d 20 57 65 20 75 |../*.1.0|1 - We u|
|000063f0| 73 65 64 20 74 6f 20 6d | 61 6b 65 20 61 20 63 68 |sed to m|ake a ch|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.